| Index: src/mips/full-codegen-mips.cc
|
| ===================================================================
|
| --- src/mips/full-codegen-mips.cc (revision 8618)
|
| +++ src/mips/full-codegen-mips.cc (working copy)
|
| @@ -101,16 +101,18 @@
|
| }
|
|
|
| void EmitPatchInfo() {
|
| - int delta_to_patch_site = masm_->InstructionsGeneratedSince(&patch_site_);
|
| - Register reg = Register::from_code(delta_to_patch_site / kImm16Mask);
|
| - __ andi(at, reg, delta_to_patch_site % kImm16Mask);
|
| + if (patch_site_.is_bound()) {
|
| + int delta_to_patch_site = masm_->InstructionsGeneratedSince(&patch_site_);
|
| + Register reg = Register::from_code(delta_to_patch_site / kImm16Mask);
|
| + __ andi(at, reg, delta_to_patch_site % kImm16Mask);
|
| #ifdef DEBUG
|
| - info_emitted_ = true;
|
| + info_emitted_ = true;
|
| #endif
|
| + } else {
|
| + __ nop(); // Signals no inlined code.
|
| + }
|
| }
|
|
|
| - bool is_bound() const { return patch_site_.is_bound(); }
|
| -
|
| private:
|
| MacroAssembler* masm_;
|
| Label patch_site_;
|
| @@ -137,6 +139,7 @@
|
| void FullCodeGenerator::Generate(CompilationInfo* info) {
|
| ASSERT(info_ == NULL);
|
| info_ = info;
|
| + scope_ = info->scope();
|
| SetFunctionPosition(function());
|
| Comment cmnt(masm_, "[ function compiled by full code generator");
|
|
|
| @@ -147,20 +150,20 @@
|
| }
|
| #endif
|
|
|
| - // Strict mode functions need to replace the receiver with undefined
|
| - // when called as functions (without an explicit receiver
|
| - // object). t1 is zero for method calls and non-zero for function
|
| - // calls.
|
| - if (info->is_strict_mode()) {
|
| + // Strict mode functions and builtins need to replace the receiver
|
| + // with undefined when called as functions (without an explicit
|
| + // receiver object). t1 is zero for method calls and non-zero for
|
| + // function calls.
|
| + if (info->is_strict_mode() || info->is_native()) {
|
| Label ok;
|
| __ Branch(&ok, eq, t1, Operand(zero_reg));
|
| - int receiver_offset = scope()->num_parameters() * kPointerSize;
|
| + int receiver_offset = info->scope()->num_parameters() * kPointerSize;
|
| __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
|
| __ sw(a2, MemOperand(sp, receiver_offset));
|
| __ bind(&ok);
|
| }
|
|
|
| - int locals_count = scope()->num_stack_slots();
|
| + int locals_count = info->scope()->num_stack_slots();
|
|
|
| __ Push(ra, fp, cp, a1);
|
| if (locals_count > 0) {
|
| @@ -180,7 +183,7 @@
|
| bool function_in_register = true;
|
|
|
| // Possibly allocate a local context.
|
| - int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
|
| + int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
|
| if (heap_slots > 0) {
|
| Comment cmnt(masm_, "[ Allocate local context");
|
| // Argument to NewContext is the function, which is in a1.
|
| @@ -189,14 +192,14 @@
|
| FastNewContextStub stub(heap_slots);
|
| __ CallStub(&stub);
|
| } else {
|
| - __ CallRuntime(Runtime::kNewContext, 1);
|
| + __ CallRuntime(Runtime::kNewFunctionContext, 1);
|
| }
|
| function_in_register = false;
|
| // Context is returned in both v0 and cp. It replaces the context
|
| // passed to us. It's saved in the stack and kept live in cp.
|
| __ sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| // Copy any necessary parameters into the context.
|
| - int num_parameters = scope()->num_parameters();
|
| + int num_parameters = info->scope()->num_parameters();
|
| for (int i = 0; i < num_parameters; i++) {
|
| Slot* slot = scope()->parameter(i)->AsSlot();
|
| if (slot != NULL && slot->type() == Slot::CONTEXT) {
|
| @@ -228,27 +231,28 @@
|
| __ mov(a3, a1);
|
| }
|
| // Receiver is just before the parameters on the caller's stack.
|
| - int offset = scope()->num_parameters() * kPointerSize;
|
| + int num_parameters = info->scope()->num_parameters();
|
| + int offset = num_parameters * kPointerSize;
|
| __ Addu(a2, fp,
|
| Operand(StandardFrameConstants::kCallerSPOffset + offset));
|
| - __ li(a1, Operand(Smi::FromInt(scope()->num_parameters())));
|
| + __ li(a1, Operand(Smi::FromInt(num_parameters)));
|
| __ Push(a3, a2, a1);
|
|
|
| // Arguments to ArgumentsAccessStub:
|
| // function, receiver address, parameter count.
|
| // The stub will rewrite receiever and parameter count if the previous
|
| // stack frame was an arguments adapter frame.
|
| - ArgumentsAccessStub stub(
|
| - is_strict_mode() ? ArgumentsAccessStub::NEW_STRICT
|
| - : ArgumentsAccessStub::NEW_NON_STRICT);
|
| + ArgumentsAccessStub::Type type;
|
| + if (is_strict_mode()) {
|
| + type = ArgumentsAccessStub::NEW_STRICT;
|
| + } else if (function()->has_duplicate_parameters()) {
|
| + type = ArgumentsAccessStub::NEW_NON_STRICT_SLOW;
|
| + } else {
|
| + type = ArgumentsAccessStub::NEW_NON_STRICT_FAST;
|
| + }
|
| + ArgumentsAccessStub stub(type);
|
| __ CallStub(&stub);
|
|
|
| - Variable* arguments_shadow = scope()->arguments_shadow();
|
| - if (arguments_shadow != NULL) {
|
| - // Duplicate the value; move-to-slot operation might clobber registers.
|
| - __ mov(a3, v0);
|
| - Move(arguments_shadow->AsSlot(), a3, a1, a2);
|
| - }
|
| Move(arguments->AsSlot(), v0, a1, a2);
|
| }
|
|
|
| @@ -348,7 +352,7 @@
|
| { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
|
| // Here we use masm_-> instead of the __ macro to avoid the code coverage
|
| // tool from instrumenting as we rely on the code size here.
|
| - int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize;
|
| + int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize;
|
| CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
|
| __ RecordJSReturn();
|
| masm_->mov(sp, fp);
|
| @@ -386,7 +390,7 @@
|
| // For simplicity we always test the accumulator register.
|
| codegen()->Move(result_register(), slot);
|
| codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
|
| - codegen()->DoTest(true_label_, false_label_, fall_through_);
|
| + codegen()->DoTest(this);
|
| }
|
|
|
|
|
| @@ -420,7 +424,7 @@
|
| if (true_label_ != fall_through_) __ Branch(true_label_);
|
| } else {
|
| __ LoadRoot(result_register(), index);
|
| - codegen()->DoTest(true_label_, false_label_, fall_through_);
|
| + codegen()->DoTest(this);
|
| }
|
| }
|
|
|
| @@ -467,7 +471,7 @@
|
| } else {
|
| // For simplicity we always test the accumulator register.
|
| __ li(result_register(), Operand(lit));
|
| - codegen()->DoTest(true_label_, false_label_, fall_through_);
|
| + codegen()->DoTest(this);
|
| }
|
| }
|
|
|
| @@ -503,7 +507,7 @@
|
| __ Drop(count);
|
| __ Move(result_register(), reg);
|
| codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
|
| - codegen()->DoTest(true_label_, false_label_, fall_through_);
|
| + codegen()->DoTest(this);
|
| }
|
|
|
|
|
| @@ -581,7 +585,8 @@
|
| }
|
|
|
|
|
| -void FullCodeGenerator::DoTest(Label* if_true,
|
| +void FullCodeGenerator::DoTest(Expression* condition,
|
| + Label* if_true,
|
| Label* if_false,
|
| Label* fall_through) {
|
| if (CpuFeatures::IsSupported(FPU)) {
|
| @@ -715,10 +720,14 @@
|
| // context.
|
| ASSERT_EQ(0, scope()->ContextChainLength(variable->scope()));
|
| if (FLAG_debug_code) {
|
| - // Check that we're not inside a 'with'.
|
| - __ lw(a1, ContextOperand(cp, Context::FCONTEXT_INDEX));
|
| - __ Check(eq, "Unexpected declaration in current context.",
|
| - a1, Operand(cp));
|
| + // Check that we're not inside a with or catch context.
|
| + __ lw(a1, FieldMemOperand(cp, HeapObject::kMapOffset));
|
| + __ LoadRoot(t0, Heap::kWithContextMapRootIndex);
|
| + __ Check(ne, "Declaration in with context.",
|
| + a1, Operand(t0));
|
| + __ LoadRoot(t0, Heap::kCatchContextMapRootIndex);
|
| + __ Check(ne, "Declaration in catch context.",
|
| + a1, Operand(t0));
|
| }
|
| if (mode == Variable::CONST) {
|
| __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
|
| @@ -789,7 +798,7 @@
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber);
|
| + __ Call(ic);
|
| // Value in v0 is ignored (declarations are statements).
|
| }
|
| }
|
| @@ -864,7 +873,8 @@
|
| // Record position before stub call for type feedback.
|
| SetSourcePosition(clause->position());
|
| Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT);
|
| - EmitCallIC(ic, &patch_site, clause->CompareId());
|
| + __ Call(ic, RelocInfo::CODE_TARGET, clause->CompareId());
|
| + patch_site.EmitPatchInfo();
|
|
|
| __ Branch(&next_test, ne, v0, Operand(zero_reg));
|
| __ Drop(1); // Switch value is no longer needed.
|
| @@ -918,7 +928,7 @@
|
| Label convert, done_convert;
|
| __ JumpIfSmi(a0, &convert);
|
| __ GetObjectType(a0, a1, a1);
|
| - __ Branch(&done_convert, hs, a1, Operand(FIRST_JS_OBJECT_TYPE));
|
| + __ Branch(&done_convert, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE));
|
| __ bind(&convert);
|
| __ push(a0);
|
| __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
|
| @@ -1128,8 +1138,7 @@
|
| __ Branch(slow, ne, temp, Operand(zero_reg));
|
| }
|
| // Load next context in chain.
|
| - __ lw(next, ContextOperand(current, Context::CLOSURE_INDEX));
|
| - __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
|
| + __ lw(next, ContextOperand(current, Context::PREVIOUS_INDEX));
|
| // Walk the rest of the chain without clobbering cp.
|
| current = next;
|
| }
|
| @@ -1153,8 +1162,7 @@
|
| __ lw(temp, ContextOperand(next, Context::EXTENSION_INDEX));
|
| __ Branch(slow, ne, temp, Operand(zero_reg));
|
| // Load next context in chain.
|
| - __ lw(next, ContextOperand(next, Context::CLOSURE_INDEX));
|
| - __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
|
| + __ lw(next, ContextOperand(next, Context::PREVIOUS_INDEX));
|
| __ Branch(&loop);
|
| __ bind(&fast);
|
| }
|
| @@ -1165,7 +1173,7 @@
|
| ? RelocInfo::CODE_TARGET
|
| : RelocInfo::CODE_TARGET_CONTEXT;
|
| Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
| - EmitCallIC(ic, mode, AstNode::kNoNumber);
|
| + __ Call(ic, mode);
|
| }
|
|
|
|
|
| @@ -1184,8 +1192,7 @@
|
| __ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX));
|
| __ Branch(slow, ne, temp, Operand(zero_reg));
|
| }
|
| - __ lw(next, ContextOperand(context, Context::CLOSURE_INDEX));
|
| - __ lw(next, FieldMemOperand(next, JSFunction::kContextOffset));
|
| + __ lw(next, ContextOperand(context, Context::PREVIOUS_INDEX));
|
| // Walk the rest of the chain without clobbering cp.
|
| context = next;
|
| }
|
| @@ -1246,7 +1253,7 @@
|
| __ li(a0, Operand(key_literal->handle()));
|
| Handle<Code> ic =
|
| isolate()->builtins()->KeyedLoadIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property));
|
| + __ Call(ic, RelocInfo::CODE_TARGET, GetPropertyId(property));
|
| __ Branch(done);
|
| }
|
| }
|
| @@ -1256,23 +1263,22 @@
|
|
|
|
|
| void FullCodeGenerator::EmitVariableLoad(Variable* var) {
|
| - // Four cases: non-this global variables, lookup slots, all other
|
| - // types of slots, and parameters that rewrite to explicit property
|
| - // accesses on the arguments object.
|
| + // Three cases: non-this global variables, lookup slots, and all other
|
| + // types of slots.
|
| Slot* slot = var->AsSlot();
|
| - Property* property = var->AsProperty();
|
| + ASSERT((var->is_global() && !var->is_this()) == (slot == NULL));
|
|
|
| - if (var->is_global() && !var->is_this()) {
|
| + if (slot == NULL) {
|
| Comment cmnt(masm_, "Global variable");
|
| // Use inline caching. Variable name is passed in a2 and the global
|
| // object (receiver) in a0.
|
| __ lw(a0, GlobalObjectOperand());
|
| __ li(a2, Operand(var->name()));
|
| Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT, AstNode::kNoNumber);
|
| + __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
|
| context()->Plug(v0);
|
|
|
| - } else if (slot != NULL && slot->type() == Slot::LOOKUP) {
|
| + } else if (slot->type() == Slot::LOOKUP) {
|
| Label done, slow;
|
|
|
| // Generate code for loading from variables potentially shadowed
|
| @@ -1288,7 +1294,7 @@
|
|
|
| context()->Plug(v0);
|
|
|
| - } else if (slot != NULL) {
|
| + } else {
|
| Comment cmnt(masm_, (slot->type() == Slot::CONTEXT)
|
| ? "Context slot"
|
| : "Stack slot");
|
| @@ -1305,31 +1311,6 @@
|
| } else {
|
| context()->Plug(slot);
|
| }
|
| - } else {
|
| - Comment cmnt(masm_, "Rewritten parameter");
|
| - ASSERT_NOT_NULL(property);
|
| - // Rewritten parameter accesses are of the form "slot[literal]".
|
| - // Assert that the object is in a slot.
|
| - Variable* object_var = property->obj()->AsVariableProxy()->AsVariable();
|
| - ASSERT_NOT_NULL(object_var);
|
| - Slot* object_slot = object_var->AsSlot();
|
| - ASSERT_NOT_NULL(object_slot);
|
| -
|
| - // Load the object.
|
| - Move(a1, object_slot);
|
| -
|
| - // Assert that the key is a smi.
|
| - Literal* key_literal = property->key()->AsLiteral();
|
| - ASSERT_NOT_NULL(key_literal);
|
| - ASSERT(key_literal->handle()->IsSmi());
|
| -
|
| - // Load the key.
|
| - __ li(a0, Operand(key_literal->handle()));
|
| -
|
| - // Call keyed load IC. It has arguments key and receiver in a0 and a1.
|
| - Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property));
|
| - context()->Plug(v0);
|
| }
|
| }
|
|
|
| @@ -1440,7 +1421,7 @@
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->StoreIC_Initialize_Strict()
|
| : isolate()->builtins()->StoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, key->id());
|
| + __ Call(ic, RelocInfo::CODE_TARGET, key->id());
|
| PrepareForBailoutForId(key->id(), NO_REGISTERS);
|
| } else {
|
| VisitForEffect(value);
|
| @@ -1573,7 +1554,7 @@
|
| }
|
|
|
| // Left-hand side can only be a property, a global or a (parameter or local)
|
| - // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY.
|
| + // slot.
|
| enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
|
| LhsKind assign_type = VARIABLE;
|
| Property* property = expr->target()->AsProperty();
|
| @@ -1600,27 +1581,13 @@
|
| case KEYED_PROPERTY:
|
| // We need the key and receiver on both the stack and in v0 and a1.
|
| if (expr->is_compound()) {
|
| - if (property->is_arguments_access()) {
|
| - VariableProxy* obj_proxy = property->obj()->AsVariableProxy();
|
| - __ lw(v0, EmitSlotSearch(obj_proxy->var()->AsSlot(), v0));
|
| - __ push(v0);
|
| - __ li(v0, Operand(property->key()->AsLiteral()->handle()));
|
| - } else {
|
| - VisitForStackValue(property->obj());
|
| - VisitForAccumulatorValue(property->key());
|
| - }
|
| + VisitForStackValue(property->obj());
|
| + VisitForAccumulatorValue(property->key());
|
| __ lw(a1, MemOperand(sp, 0));
|
| __ push(v0);
|
| } else {
|
| - if (property->is_arguments_access()) {
|
| - VariableProxy* obj_proxy = property->obj()->AsVariableProxy();
|
| - __ lw(a1, EmitSlotSearch(obj_proxy->var()->AsSlot(), v0));
|
| - __ li(v0, Operand(property->key()->AsLiteral()->handle()));
|
| - __ Push(a1, v0);
|
| - } else {
|
| - VisitForStackValue(property->obj());
|
| - VisitForStackValue(property->key());
|
| - }
|
| + VisitForStackValue(property->obj());
|
| + VisitForStackValue(property->key());
|
| }
|
| break;
|
| }
|
| @@ -1698,7 +1665,7 @@
|
| __ li(a2, Operand(key->handle()));
|
| // Call load IC. It has arguments receiver and property name a0 and a2.
|
| Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| + __ Call(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| }
|
|
|
|
|
| @@ -1707,7 +1674,7 @@
|
| __ mov(a0, result_register());
|
| // Call keyed load IC. It has arguments key and receiver in a0 and a1.
|
| Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| + __ Call(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| }
|
|
|
|
|
| @@ -1735,7 +1702,8 @@
|
|
|
| __ bind(&stub_call);
|
| BinaryOpStub stub(op, mode);
|
| - EmitCallIC(stub.GetCode(), &patch_site, expr->id());
|
| + __ Call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
|
| + patch_site.EmitPatchInfo();
|
| __ jmp(&done);
|
|
|
| __ bind(&smi_case);
|
| @@ -1816,7 +1784,9 @@
|
| __ mov(a0, result_register());
|
| __ pop(a1);
|
| BinaryOpStub stub(op, mode);
|
| - EmitCallIC(stub.GetCode(), NULL, expr->id());
|
| + JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
|
| + __ Call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
|
| + patch_site.EmitPatchInfo();
|
| context()->Plug(v0);
|
| }
|
|
|
| @@ -1830,7 +1800,7 @@
|
| }
|
|
|
| // Left-hand side can only be a property, a global or a (parameter or local)
|
| - // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY.
|
| + // slot.
|
| enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
|
| LhsKind assign_type = VARIABLE;
|
| Property* prop = expr->AsProperty();
|
| @@ -1856,30 +1826,20 @@
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->StoreIC_Initialize_Strict()
|
| : isolate()->builtins()->StoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber);
|
| + __ Call(ic);
|
| break;
|
| }
|
| case KEYED_PROPERTY: {
|
| __ push(result_register()); // Preserve value.
|
| - if (prop->is_synthetic()) {
|
| - ASSERT(prop->obj()->AsVariableProxy() != NULL);
|
| - ASSERT(prop->key()->AsLiteral() != NULL);
|
| - { AccumulatorValueContext for_object(this);
|
| - EmitVariableLoad(prop->obj()->AsVariableProxy()->var());
|
| - }
|
| - __ mov(a2, result_register());
|
| - __ li(a1, Operand(prop->key()->AsLiteral()->handle()));
|
| - } else {
|
| - VisitForStackValue(prop->obj());
|
| - VisitForAccumulatorValue(prop->key());
|
| - __ mov(a1, result_register());
|
| - __ pop(a2);
|
| - }
|
| + VisitForStackValue(prop->obj());
|
| + VisitForAccumulatorValue(prop->key());
|
| + __ mov(a1, result_register());
|
| + __ pop(a2);
|
| __ pop(a0); // Restore value.
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber);
|
| + __ Call(ic);
|
| break;
|
| }
|
| }
|
| @@ -1890,8 +1850,6 @@
|
|
|
| void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| Token::Value op) {
|
| - // Left-hand sides that rewrite to explicit property accesses do not reach
|
| - // here.
|
| ASSERT(var != NULL);
|
| ASSERT(var->is_global() || var->AsSlot() != NULL);
|
|
|
| @@ -1906,7 +1864,7 @@
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->StoreIC_Initialize_Strict()
|
| : isolate()->builtins()->StoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT, AstNode::kNoNumber);
|
| + __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
|
|
|
| } else if (op == Token::INIT_CONST) {
|
| // Like var declarations, const declarations are hoisted to function
|
| @@ -1927,17 +1885,7 @@
|
| __ Branch(&skip, ne, a1, Operand(t0));
|
| __ sw(result_register(), MemOperand(fp, SlotOffset(slot)));
|
| break;
|
| - case Slot::CONTEXT: {
|
| - __ lw(a1, ContextOperand(cp, Context::FCONTEXT_INDEX));
|
| - __ lw(a2, ContextOperand(a1, slot->index()));
|
| - __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
|
| - __ Branch(&skip, ne, a2, Operand(t0));
|
| - __ sw(result_register(), ContextOperand(a1, slot->index()));
|
| - int offset = Context::SlotOffset(slot->index());
|
| - __ mov(a3, result_register()); // Preserve the stored value in v0.
|
| - __ RecordWrite(a1, Operand(offset), a3, a2);
|
| - break;
|
| - }
|
| + case Slot::CONTEXT:
|
| case Slot::LOOKUP:
|
| __ push(result_register());
|
| __ li(a0, Operand(slot->var()->name()));
|
| @@ -2014,7 +1962,7 @@
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->StoreIC_Initialize_Strict()
|
| : isolate()->builtins()->StoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
| + __ Call(ic, RelocInfo::CODE_TARGET, expr->id());
|
|
|
| // If the assignment ends an initialization block, revert to fast case.
|
| if (expr->ends_initialization_block()) {
|
| @@ -2066,7 +2014,7 @@
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
| + __ Call(ic, RelocInfo::CODE_TARGET, expr->id());
|
|
|
| // If the assignment ends an initialization block, revert to fast case.
|
| if (expr->ends_initialization_block()) {
|
| @@ -2119,7 +2067,7 @@
|
| InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
|
| Handle<Code> ic =
|
| isolate()->stub_cache()->ComputeCallInitialize(arg_count, in_loop, mode);
|
| - EmitCallIC(ic, mode, expr->id());
|
| + __ Call(ic, mode, expr->id());
|
| RecordJSReturnSite(expr);
|
| // Restore context register.
|
| __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| @@ -2153,7 +2101,7 @@
|
| Handle<Code> ic =
|
| isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count, in_loop);
|
| __ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key.
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
| + __ Call(ic, RelocInfo::CODE_TARGET, expr->id());
|
| RecordJSReturnSite(expr);
|
| // Restore context register.
|
| __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| @@ -2193,7 +2141,8 @@
|
| __ push(a1);
|
|
|
| // Push the receiver of the enclosing function and do runtime call.
|
| - __ lw(a1, MemOperand(fp, (2 + scope()->num_parameters()) * kPointerSize));
|
| + int receiver_offset = 2 + info_->scope()->num_parameters();
|
| + __ lw(a1, MemOperand(fp, receiver_offset * kPointerSize));
|
| __ push(a1);
|
| // Push the strict mode flag.
|
| __ li(a1, Operand(Smi::FromInt(strict_mode_flag())));
|
| @@ -2310,9 +2259,9 @@
|
| __ bind(&done);
|
| // Push function.
|
| __ push(v0);
|
| - // Push global receiver.
|
| - __ lw(a1, GlobalObjectOperand());
|
| - __ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalReceiverOffset));
|
| + // The receiver is implicitly the global receiver. Indicate this
|
| + // by passing the hole to the call function stub.
|
| + __ LoadRoot(a1, Heap::kTheHoleValueRootIndex);
|
| __ push(a1);
|
| __ bind(&call);
|
| }
|
| @@ -2334,7 +2283,7 @@
|
| } else {
|
| // Call to a keyed property.
|
| // For a synthetic property use keyed load IC followed by function call,
|
| - // for a regular property use keyed EmitCallIC.
|
| + // for a regular property use EmitKeyedCallWithIC.
|
| if (prop->is_synthetic()) {
|
| // Do not visit the object and key subexpressions (they are shared
|
| // by all occurrences of the same rewritten parameter).
|
| @@ -2352,7 +2301,7 @@
|
| SetSourcePosition(prop->position());
|
|
|
| Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| + __ Call(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| __ lw(a1, GlobalObjectOperand());
|
| __ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalReceiverOffset));
|
| __ Push(v0, a1); // Function, receiver.
|
| @@ -2477,9 +2426,10 @@
|
| __ And(at, a1, Operand(1 << Map::kIsUndetectable));
|
| __ Branch(if_false, ne, at, Operand(zero_reg));
|
| __ lbu(a1, FieldMemOperand(a2, Map::kInstanceTypeOffset));
|
| - __ Branch(if_false, lt, a1, Operand(FIRST_JS_OBJECT_TYPE));
|
| + __ Branch(if_false, lt, a1, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
|
| PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| - Split(le, a1, Operand(LAST_JS_OBJECT_TYPE), if_true, if_false, fall_through);
|
| + Split(le, a1, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE),
|
| + if_true, if_false, fall_through);
|
|
|
| context()->Plug(if_true, if_false);
|
| }
|
| @@ -2500,7 +2450,7 @@
|
| __ JumpIfSmi(v0, if_false);
|
| __ GetObjectType(v0, a1, a1);
|
| PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| - Split(ge, a1, Operand(FIRST_JS_OBJECT_TYPE),
|
| + Split(ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE),
|
| if_true, if_false, fall_through);
|
|
|
| context()->Plug(if_true, if_false);
|
| @@ -2738,7 +2688,7 @@
|
| // parameter count in a0.
|
| VisitForAccumulatorValue(args->at(0));
|
| __ mov(a1, v0);
|
| - __ li(a0, Operand(Smi::FromInt(scope()->num_parameters())));
|
| + __ li(a0, Operand(Smi::FromInt(info_->scope()->num_parameters())));
|
| ArgumentsAccessStub stub(ArgumentsAccessStub::READ_ELEMENT);
|
| __ CallStub(&stub);
|
| context()->Plug(v0);
|
| @@ -2750,7 +2700,7 @@
|
|
|
| Label exit;
|
| // Get the number of formal parameters.
|
| - __ li(v0, Operand(Smi::FromInt(scope()->num_parameters())));
|
| + __ li(v0, Operand(Smi::FromInt(info_->scope()->num_parameters())));
|
|
|
| // Check if the calling frame is an arguments adaptor frame.
|
| __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
| @@ -2779,14 +2729,15 @@
|
| // Check that the object is a JS object but take special care of JS
|
| // functions to make sure they have 'Function' as their class.
|
| __ GetObjectType(v0, v0, a1); // Map is now in v0.
|
| - __ Branch(&null, lt, a1, Operand(FIRST_JS_OBJECT_TYPE));
|
| + __ Branch(&null, lt, a1, Operand(FIRST_SPEC_OBJECT_TYPE));
|
|
|
| - // As long as JS_FUNCTION_TYPE is the last instance type and it is
|
| - // right after LAST_JS_OBJECT_TYPE, we can avoid checking for
|
| - // LAST_JS_OBJECT_TYPE.
|
| - ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
|
| - ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1);
|
| - __ Branch(&function, eq, a1, Operand(JS_FUNCTION_TYPE));
|
| + // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last instance type, and
|
| + // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after
|
| + // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter.
|
| + STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
|
| + STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE ==
|
| + LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1);
|
| + __ Branch(&function, ge, a1, Operand(FIRST_CALLABLE_SPEC_OBJECT_TYPE));
|
|
|
| // Check if the constructor in the map is a function.
|
| __ lw(v0, FieldMemOperand(v0, Map::kConstructorOffset));
|
| @@ -3184,7 +3135,8 @@
|
| // InvokeFunction requires the function in a1. Move it in there.
|
| __ mov(a1, result_register());
|
| ParameterCount count(arg_count);
|
| - __ InvokeFunction(a1, count, CALL_FUNCTION);
|
| + __ InvokeFunction(a1, count, CALL_FUNCTION,
|
| + NullCallWrapper(), CALL_AS_METHOD);
|
| __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| context()->Plug(v0);
|
| }
|
| @@ -3443,9 +3395,7 @@
|
| __ Branch(&bailout, ne, scratch2, Operand(JS_ARRAY_TYPE));
|
|
|
| // Check that the array has fast elements.
|
| - __ lbu(scratch2, FieldMemOperand(scratch1, Map::kBitField2Offset));
|
| - __ And(scratch3, scratch2, Operand(1 << Map::kHasFastElements));
|
| - __ Branch(&bailout, eq, scratch3, Operand(zero_reg));
|
| + __ CheckFastElements(scratch1, scratch2, &bailout);
|
|
|
| // If the array has length zero, return the empty string.
|
| __ lw(array_length, FieldMemOperand(array, JSArray::kLengthOffset));
|
| @@ -3649,6 +3599,39 @@
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitIsNativeOrStrictMode(ZoneList<Expression*>* args) {
|
| + ASSERT(args->length() == 1);
|
| +
|
| + // Load the function into v0.
|
| + VisitForAccumulatorValue(args->at(0));
|
| +
|
| + // Prepare for the test.
|
| + Label materialize_true, materialize_false;
|
| + Label* if_true = NULL;
|
| + Label* if_false = NULL;
|
| + Label* fall_through = NULL;
|
| + context()->PrepareTest(&materialize_true, &materialize_false,
|
| + &if_true, &if_false, &fall_through);
|
| +
|
| + // Test for strict mode function.
|
| + __ lw(a1, FieldMemOperand(v0, JSFunction::kSharedFunctionInfoOffset));
|
| + __ lw(a1, FieldMemOperand(a1, SharedFunctionInfo::kCompilerHintsOffset));
|
| + __ And(at, a1, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
|
| + kSmiTagSize)));
|
| + __ Branch(if_true, ne, at, Operand(zero_reg));
|
| +
|
| + // Test for native function.
|
| + __ And(at, a1, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
|
| + __ Branch(if_true, ne, at, Operand(zero_reg));
|
| +
|
| + // Not native or strict-mode function.
|
| + __ Branch(if_false);
|
| +
|
| + PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| + context()->Plug(if_true, if_false);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
| Handle<String> name = expr->name();
|
| if (name->length() > 0 && name->Get(0) == '_') {
|
| @@ -3681,7 +3664,7 @@
|
| isolate()->stub_cache()->ComputeCallInitialize(arg_count,
|
| NOT_IN_LOOP,
|
| mode);
|
| - EmitCallIC(ic, mode, expr->id());
|
| + __ Call(ic, mode, expr->id());
|
| // Restore context register.
|
| __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| } else {
|
| @@ -3824,7 +3807,7 @@
|
| VisitForAccumulatorValue(expr->expression());
|
| SetSourcePosition(expr->position());
|
| __ mov(a0, result_register());
|
| - EmitCallIC(stub.GetCode(), NULL, expr->id());
|
| + __ Call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
|
| context()->Plug(v0);
|
| }
|
|
|
| @@ -3841,7 +3824,7 @@
|
| }
|
|
|
| // Expression can only be a property, a global or a (parameter or local)
|
| - // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY.
|
| + // slot.
|
| enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
|
| LhsKind assign_type = VARIABLE;
|
| Property* prop = expr->expression()->AsProperty();
|
| @@ -3869,15 +3852,8 @@
|
| __ push(v0);
|
| EmitNamedPropertyLoad(prop);
|
| } else {
|
| - if (prop->is_arguments_access()) {
|
| - VariableProxy* obj_proxy = prop->obj()->AsVariableProxy();
|
| - __ lw(v0, EmitSlotSearch(obj_proxy->var()->AsSlot(), v0));
|
| - __ push(v0);
|
| - __ li(v0, Operand(prop->key()->AsLiteral()->handle()));
|
| - } else {
|
| - VisitForStackValue(prop->obj());
|
| - VisitForAccumulatorValue(prop->key());
|
| - }
|
| + VisitForStackValue(prop->obj());
|
| + VisitForAccumulatorValue(prop->key());
|
| __ lw(a1, MemOperand(sp, 0));
|
| __ push(v0);
|
| EmitKeyedPropertyLoad(prop);
|
| @@ -3942,7 +3918,8 @@
|
| SetSourcePosition(expr->position());
|
|
|
| BinaryOpStub stub(Token::ADD, NO_OVERWRITE);
|
| - EmitCallIC(stub.GetCode(), &patch_site, expr->CountId());
|
| + __ Call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountId());
|
| + patch_site.EmitPatchInfo();
|
| __ bind(&done);
|
|
|
| // Store the value returned in v0.
|
| @@ -3974,7 +3951,7 @@
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->StoreIC_Initialize_Strict()
|
| : isolate()->builtins()->StoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
| + __ Call(ic, RelocInfo::CODE_TARGET, expr->id());
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| if (expr->is_postfix()) {
|
| if (!context()->IsEffect()) {
|
| @@ -3992,7 +3969,7 @@
|
| Handle<Code> ic = is_strict_mode()
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize();
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
| + __ Call(ic, RelocInfo::CODE_TARGET, expr->id());
|
| PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
|
| if (expr->is_postfix()) {
|
| if (!context()->IsEffect()) {
|
| @@ -4016,7 +3993,7 @@
|
| Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
| // Use a regular load, not a contextual load, to avoid a reference
|
| // error.
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber);
|
| + __ Call(ic);
|
| PrepareForBailout(expr, TOS_REG);
|
| context()->Plug(v0);
|
| } else if (proxy != NULL &&
|
| @@ -4039,30 +4016,17 @@
|
| context()->Plug(v0);
|
| } else {
|
| // This expression cannot throw a reference error at the top level.
|
| - context()->HandleExpression(expr);
|
| + VisitInCurrentContext(expr);
|
| }
|
| }
|
|
|
| -
|
| -bool FullCodeGenerator::TryLiteralCompare(Token::Value op,
|
| - Expression* left,
|
| - Expression* right,
|
| - Label* if_true,
|
| - Label* if_false,
|
| - Label* fall_through) {
|
| - if (op != Token::EQ && op != Token::EQ_STRICT) return false;
|
| -
|
| - // Check for the pattern: typeof <expression> == <string literal>.
|
| - Literal* right_literal = right->AsLiteral();
|
| - if (right_literal == NULL) return false;
|
| - Handle<Object> right_literal_value = right_literal->handle();
|
| - if (!right_literal_value->IsString()) return false;
|
| - UnaryOperation* left_unary = left->AsUnaryOperation();
|
| - if (left_unary == NULL || left_unary->op() != Token::TYPEOF) return false;
|
| - Handle<String> check = Handle<String>::cast(right_literal_value);
|
| -
|
| +void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr,
|
| + Handle<String> check,
|
| + Label* if_true,
|
| + Label* if_false,
|
| + Label* fall_through) {
|
| { AccumulatorValueContext context(this);
|
| - VisitForTypeofValue(left_unary->expression());
|
| + VisitForTypeofValue(expr);
|
| }
|
| PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
|
|
| @@ -4097,7 +4061,7 @@
|
| } else if (check->Equals(isolate()->heap()->function_symbol())) {
|
| __ JumpIfSmi(v0, if_false);
|
| __ GetObjectType(v0, a1, v0); // Leave map in a1.
|
| - Split(ge, v0, Operand(FIRST_FUNCTION_CLASS_TYPE),
|
| + Split(ge, v0, Operand(FIRST_CALLABLE_SPEC_OBJECT_TYPE),
|
| if_true, if_false, fall_through);
|
|
|
| } else if (check->Equals(isolate()->heap()->object_symbol())) {
|
| @@ -4106,9 +4070,9 @@
|
| __ Branch(if_true, eq, v0, Operand(at));
|
| // Check for JS objects => true.
|
| __ GetObjectType(v0, v0, a1);
|
| - __ Branch(if_false, lo, a1, Operand(FIRST_JS_OBJECT_TYPE));
|
| + __ Branch(if_false, lt, a1, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE));
|
| __ lbu(a1, FieldMemOperand(v0, Map::kInstanceTypeOffset));
|
| - __ Branch(if_false, hs, a1, Operand(FIRST_FUNCTION_CLASS_TYPE));
|
| + __ Branch(if_false, gt, a1, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE));
|
| // Check for undetectable objects => false.
|
| __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset));
|
| __ And(a1, a1, Operand(1 << Map::kIsUndetectable));
|
| @@ -4116,8 +4080,18 @@
|
| } else {
|
| if (if_false != fall_through) __ jmp(if_false);
|
| }
|
| +}
|
|
|
| - return true;
|
| +
|
| +void FullCodeGenerator::EmitLiteralCompareUndefined(Expression* expr,
|
| + Label* if_true,
|
| + Label* if_false,
|
| + Label* fall_through) {
|
| + VisitForAccumulatorValue(expr);
|
| + PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| +
|
| + __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
|
| + Split(eq, v0, Operand(at), if_true, if_false, fall_through);
|
| }
|
|
|
|
|
| @@ -4137,14 +4111,12 @@
|
|
|
| // First we try a fast inlined version of the compare when one of
|
| // the operands is a literal.
|
| - Token::Value op = expr->op();
|
| - Expression* left = expr->left();
|
| - Expression* right = expr->right();
|
| - if (TryLiteralCompare(op, left, right, if_true, if_false, fall_through)) {
|
| + if (TryLiteralCompare(expr, if_true, if_false, fall_through)) {
|
| context()->Plug(if_true, if_false);
|
| return;
|
| }
|
|
|
| + Token::Value op = expr->op();
|
| VisitForStackValue(expr->left());
|
| switch (op) {
|
| case Token::IN:
|
| @@ -4218,7 +4190,8 @@
|
| // Record position and call the compare IC.
|
| SetSourcePosition(expr->position());
|
| Handle<Code> ic = CompareIC::GetUninitialized(op);
|
| - EmitCallIC(ic, &patch_site, expr->id());
|
| + __ Call(ic, RelocInfo::CODE_TARGET, expr->id());
|
| + patch_site.EmitPatchInfo();
|
| PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| Split(cc, v0, Operand(zero_reg), if_true, if_false, fall_through);
|
| }
|
| @@ -4277,70 +4250,6 @@
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitCallIC(Handle<Code> ic,
|
| - RelocInfo::Mode mode,
|
| - unsigned ast_id) {
|
| - ASSERT(mode == RelocInfo::CODE_TARGET ||
|
| - mode == RelocInfo::CODE_TARGET_CONTEXT);
|
| - Counters* counters = isolate()->counters();
|
| - switch (ic->kind()) {
|
| - case Code::LOAD_IC:
|
| - __ IncrementCounter(counters->named_load_full(), 1, a1, a2);
|
| - break;
|
| - case Code::KEYED_LOAD_IC:
|
| - __ IncrementCounter(counters->keyed_load_full(), 1, a1, a2);
|
| - break;
|
| - case Code::STORE_IC:
|
| - __ IncrementCounter(counters->named_store_full(), 1, a1, a2);
|
| - break;
|
| - case Code::KEYED_STORE_IC:
|
| - __ IncrementCounter(counters->keyed_store_full(), 1, a1, a2);
|
| - default:
|
| - break;
|
| - }
|
| - if (ast_id == kNoASTId || mode == RelocInfo::CODE_TARGET_CONTEXT) {
|
| - __ Call(ic, mode);
|
| - } else {
|
| - ASSERT(mode == RelocInfo::CODE_TARGET);
|
| - mode = RelocInfo::CODE_TARGET_WITH_ID;
|
| - __ CallWithAstId(ic, mode, ast_id);
|
| - }
|
| -}
|
| -
|
| -
|
| -void FullCodeGenerator::EmitCallIC(Handle<Code> ic,
|
| - JumpPatchSite* patch_site,
|
| - unsigned ast_id) {
|
| - Counters* counters = isolate()->counters();
|
| - switch (ic->kind()) {
|
| - case Code::LOAD_IC:
|
| - __ IncrementCounter(counters->named_load_full(), 1, a1, a2);
|
| - break;
|
| - case Code::KEYED_LOAD_IC:
|
| - __ IncrementCounter(counters->keyed_load_full(), 1, a1, a2);
|
| - break;
|
| - case Code::STORE_IC:
|
| - __ IncrementCounter(counters->named_store_full(), 1, a1, a2);
|
| - break;
|
| - case Code::KEYED_STORE_IC:
|
| - __ IncrementCounter(counters->keyed_store_full(), 1, a1, a2);
|
| - default:
|
| - break;
|
| - }
|
| -
|
| - if (ast_id == kNoASTId) {
|
| - __ Call(ic, RelocInfo::CODE_TARGET);
|
| - } else {
|
| - __ CallWithAstId(ic, RelocInfo::CODE_TARGET_WITH_ID, ast_id);
|
| - }
|
| - if (patch_site != NULL && patch_site->is_bound()) {
|
| - patch_site->EmitPatchInfo();
|
| - } else {
|
| - __ nop(); // Signals no inlined code.
|
| - }
|
| -}
|
| -
|
| -
|
| void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) {
|
| ASSERT_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset);
|
| __ sw(value, MemOperand(fp, frame_offset));
|
| @@ -4352,6 +4261,27 @@
|
| }
|
|
|
|
|
| +void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
|
| + Scope* declaration_scope = scope()->DeclarationScope();
|
| + if (declaration_scope->is_global_scope()) {
|
| + // Contexts nested in the global context have a canonical empty function
|
| + // as their closure, not the anonymous closure containing the global
|
| + // code. Pass a smi sentinel and let the runtime look up the empty
|
| + // function.
|
| + __ li(at, Operand(Smi::FromInt(0)));
|
| + } else if (declaration_scope->is_eval_scope()) {
|
| + // Contexts created by a call to eval have the same closure as the
|
| + // context calling eval, not the anonymous closure containing the eval
|
| + // code. Fetch it from the context.
|
| + __ lw(at, ContextOperand(cp, Context::CLOSURE_INDEX));
|
| + } else {
|
| + ASSERT(declaration_scope->is_function_scope());
|
| + __ lw(at, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| + }
|
| + __ push(at);
|
| +}
|
| +
|
| +
|
| // ----------------------------------------------------------------------------
|
| // Non-local control flow support.
|
|
|
|
|