Index: src/mips/full-codegen-mips.cc |
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc |
index 0d4ae8e24bc78ee87ae618f0f3499a32f6c85783..842edcc16d836ff22a354cb23cca656813321b81 100644 |
--- a/src/mips/full-codegen-mips.cc |
+++ b/src/mips/full-codegen-mips.cc |
@@ -54,6 +54,12 @@ namespace internal { |
#define __ ACCESS_MASM(masm_) |
+static unsigned GetPropertyId(Property* property) { |
+ if (property->is_synthetic()) return AstNode::kNoNumber; |
+ return property->id(); |
+} |
+ |
+ |
// A patch site is a location in the code which it is possible to patch. This |
// class has a number of methods to emit the code which is patchable and the |
// method EmitPatchInfo to record a marker back to the patchable code. This |
@@ -847,6 +853,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
SetSourcePosition(clause->position()); |
Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); |
EmitCallIC(ic, &patch_site, clause->CompareId()); |
+ |
__ Branch(&next_test, ne, v0, Operand(zero_reg)); |
__ Drop(1); // Switch value is no longer needed. |
__ Branch(clause->body_target()); |
@@ -1227,7 +1234,7 @@ void FullCodeGenerator::EmitDynamicLoadFromSlotFastCase( |
__ li(a0, Operand(key_literal->handle())); |
Handle<Code> ic = |
isolate()->builtins()->KeyedLoadIC_Initialize(); |
- EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); |
__ Branch(done); |
} |
} |
@@ -1309,7 +1316,7 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) { |
// 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, AstNode::kNoNumber); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); |
context()->Plug(v0); |
} |
} |
@@ -1421,7 +1428,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
Handle<Code> ic = is_strict_mode() |
? isolate()->builtins()->StoreIC_Initialize_Strict() |
: isolate()->builtins()->StoreIC_Initialize(); |
- EmitCallIC(ic, RelocInfo::CODE_TARGET_WITH_ID, key->id()); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, key->id()); |
PrepareForBailoutForId(key->id(), NO_REGISTERS); |
} else { |
VisitForEffect(value); |
@@ -1679,11 +1686,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
__ 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(); |
- if (prop->is_synthetic()) { |
- EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
- } else { |
- EmitCallIC(ic, RelocInfo::CODE_TARGET_WITH_ID, prop->id()); |
- } |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); |
} |
@@ -1692,11 +1695,7 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
__ 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(); |
- if (prop->is_synthetic()) { |
- EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
- } else { |
- EmitCallIC(ic, RelocInfo::CODE_TARGET_WITH_ID, prop->id()); |
- } |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); |
} |
@@ -2003,7 +2002,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
Handle<Code> ic = is_strict_mode() |
? isolate()->builtins()->StoreIC_Initialize_Strict() |
: isolate()->builtins()->StoreIC_Initialize(); |
- EmitCallIC(ic, RelocInfo::CODE_TARGET_WITH_ID, expr->id()); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id()); |
// If the assignment ends an initialization block, revert to fast case. |
if (expr->ends_initialization_block()) { |
@@ -2055,7 +2054,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
Handle<Code> ic = is_strict_mode() |
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
: isolate()->builtins()->KeyedStoreIC_Initialize(); |
- EmitCallIC(ic, RelocInfo::CODE_TARGET_WITH_ID, expr->id()); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id()); |
// If the assignment ends an initialization block, revert to fast case. |
if (expr->ends_initialization_block()) { |
@@ -2108,9 +2107,7 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr, |
InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; |
Handle<Code> ic = |
isolate()->stub_cache()->ComputeCallInitialize(arg_count, in_loop); |
- unsigned ast_id = |
- (mode == RelocInfo::CODE_TARGET_WITH_ID) ? expr->id() : kNoASTId; |
- EmitCallIC(ic, mode, ast_id); |
+ EmitCallIC(ic, mode, expr->id()); |
RecordJSReturnSite(expr); |
// Restore context register. |
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
@@ -2321,7 +2318,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
{ PreservePositionScope scope(masm()->positions_recorder()); |
VisitForStackValue(prop->obj()); |
} |
- EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET_WITH_ID); |
+ EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); |
} else { |
// Call to a keyed property. |
// For a synthetic property use keyed load IC followed by function call, |
@@ -2343,7 +2340,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
SetSourcePosition(prop->position()); |
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
- EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); |
__ lw(a1, GlobalObjectOperand()); |
__ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalReceiverOffset)); |
__ Push(v0, a1); // Function, receiver. |
@@ -2352,7 +2349,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
{ PreservePositionScope scope(masm()->positions_recorder()); |
VisitForStackValue(prop->obj()); |
} |
- EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET_WITH_ID); |
+ EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); |
} |
} |
} else { |
@@ -3669,7 +3666,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
__ li(a2, Operand(expr->name())); |
Handle<Code> ic = |
isolate()->stub_cache()->ComputeCallInitialize(arg_count, NOT_IN_LOOP); |
- EmitCallIC(ic, RelocInfo::CODE_TARGET_WITH_ID, expr->id()); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id()); |
// Restore context register. |
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
} else { |
@@ -3962,7 +3959,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
Handle<Code> ic = is_strict_mode() |
? isolate()->builtins()->StoreIC_Initialize_Strict() |
: isolate()->builtins()->StoreIC_Initialize(); |
- EmitCallIC(ic, RelocInfo::CODE_TARGET_WITH_ID, expr->id()); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id()); |
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
if (expr->is_postfix()) { |
if (!context()->IsEffect()) { |
@@ -3980,7 +3977,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
Handle<Code> ic = is_strict_mode() |
? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
: isolate()->builtins()->KeyedStoreIC_Initialize(); |
- EmitCallIC(ic, RelocInfo::CODE_TARGET_WITH_ID, expr->id()); |
+ EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id()); |
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
if (expr->is_postfix()) { |
if (!context()->IsEffect()) { |
@@ -4269,8 +4266,7 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, |
RelocInfo::Mode mode, |
unsigned ast_id) { |
ASSERT(mode == RelocInfo::CODE_TARGET || |
- mode == RelocInfo::CODE_TARGET_CONTEXT || |
- mode == RelocInfo::CODE_TARGET_WITH_ID); |
+ mode == RelocInfo::CODE_TARGET_CONTEXT); |
Counters* counters = isolate()->counters(); |
switch (ic->kind()) { |
case Code::LOAD_IC: |
@@ -4287,12 +4283,12 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, |
default: |
break; |
} |
- if (mode == RelocInfo::CODE_TARGET_WITH_ID) { |
- ASSERT(ast_id != kNoASTId); |
- __ CallWithAstId(ic, mode, ast_id); |
- } else { |
- ASSERT(ast_id == kNoASTId); |
+ 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); |
} |
} |
@@ -4317,10 +4313,10 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, |
break; |
} |
- if (ast_id != kNoASTId) { |
- __ CallWithAstId(ic, RelocInfo::CODE_TARGET_WITH_ID, ast_id); |
- } else { |
+ 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(); |