1.1 --- a/src/compiler/HIR.cpp Thu Dec 27 21:07:03 2012 -0800
1.2 +++ b/src/compiler/HIR.cpp Fri Dec 28 17:13:51 2012 -0800
1.3 @@ -52,6 +52,7 @@
1.4 void visitIndex(HIndex *index);
1.5 void visitPostIncDec(HPostIncDec *hir);
1.6 void visitToRef(HToRef *hir);
1.7 + void visitNewDependentArray(HNewDependentArray *hir);
1.8
1.9 private:
1.10 Zone *zone_;
1.11 @@ -438,6 +439,10 @@
1.12 unary->in()->accept(this);
1.13
1.14 switch (unary->token()) {
1.15 + case TOK_TILDE:
1.16 + __ bitnot();
1.17 + break;
1.18 +
1.19 case TOK_MINUS:
1.20 if (unary->type()->isFloat())
1.21 __ neg_f();
1.22 @@ -474,6 +479,27 @@
1.23 }
1.24
1.25 void
1.26 +HIRTranslator::visitNewDependentArray(HNewDependentArray *hir)
1.27 +{
1.28 + hir->base()->accept(this);
1.29 + hir->index()->accept(this);
1.30 +
1.31 + Local<ArrayType> type(zone_, ArrayType::cast(hir->type()));
1.32 +
1.33 + // Attach an actual map to the dependent type, in case it's a new
1.34 + // type.
1.35 + if (!ArrayMap::Attach(zone_, type))
1.36 + return;
1.37 +
1.38 + // The dependent map is used for the opcode, but is not attached.
1.39 + Local<ArrayMap> map(zone_, ArrayMap::NewDependent(zone_, type));
1.40 + if (!map)
1.41 + return;
1.42 +
1.43 + __ deparray(map);
1.44 +}
1.45 +
1.46 +void
1.47 ke::EmitHIR(Zone *zone, BytecodeEmitter &emitter, HIR *hir)
1.48 {
1.49 HIRTranslator translator(zone, emitter);