| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index dd12831c5f8319729dc541cce5458d3be532273e..95f29a8c63acbe3a8ba1017d9cefe21770148326 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -3021,7 +3021,10 @@ void HGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) {
|
|
|
|
|
| void HGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
|
| - HObjectLiteral* literal = (new HObjectLiteral(expr->constant_properties(),
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HObjectLiteral* literal = (new HObjectLiteral(context,
|
| + expr->constant_properties(),
|
| expr->fast_elements(),
|
| expr->literal_index(),
|
| expr->depth()));
|
| @@ -3048,7 +3051,9 @@ void HGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
|
| VISIT_FOR_VALUE(value);
|
| HValue* value = Pop();
|
| Handle<String> name = Handle<String>::cast(key->handle());
|
| - AddInstruction(new HStoreNamedGeneric(literal, name, value));
|
| + HStoreNamedGeneric* store =
|
| + new HStoreNamedGeneric(context, literal, name, value);
|
| + AddInstruction(store);
|
| AddSimulate(key->id());
|
| } else {
|
| VISIT_FOR_EFFECT(value);
|
| @@ -3228,7 +3233,9 @@ HInstruction* HGraphBuilder::BuildStoreNamedField(HValue* object,
|
| HInstruction* HGraphBuilder::BuildStoreNamedGeneric(HValue* object,
|
| Handle<String> name,
|
| HValue* value) {
|
| - return new HStoreNamedGeneric(object, name, value);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + return new HStoreNamedGeneric(context, object, name, value);
|
| }
|
|
|
|
|
| @@ -3290,7 +3297,7 @@ void HGraphBuilder::HandlePolymorphicStoreNamedField(Assignment* expr,
|
| // If none of the properties were named fields we generate a
|
| // generic store.
|
| if (maps.length() == 0) {
|
| - HInstruction* instr = new HStoreNamedGeneric(object, name, value);
|
| + HInstruction* instr = BuildStoreNamedGeneric(object, name, value);
|
| Push(value);
|
| instr->set_position(expr->position());
|
| AddInstruction(instr);
|
| @@ -3304,7 +3311,7 @@ void HGraphBuilder::HandlePolymorphicStoreNamedField(Assignment* expr,
|
| if (!needs_generic && FLAG_deoptimize_uncommon_cases) {
|
| subgraph->FinishExit(new HDeoptimize());
|
| } else {
|
| - HInstruction* instr = new HStoreNamedGeneric(object, name, value);
|
| + HInstruction* instr = BuildStoreNamedGeneric(object, name, value);
|
| Push(value);
|
| instr->set_position(expr->position());
|
| AddInstruction(instr);
|
| @@ -3354,7 +3361,7 @@ void HGraphBuilder::HandlePropertyAssignment(Assignment* expr) {
|
| return;
|
|
|
| } else {
|
| - instr = new HStoreNamedGeneric(object, name, value);
|
| + instr = BuildStoreNamedGeneric(object, name, value);
|
| }
|
|
|
| } else {
|
| @@ -3474,7 +3481,6 @@ void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
|
|
|
| bool is_fast_elements = prop->IsMonomorphic() &&
|
| prop->GetMonomorphicReceiverType()->has_fast_elements();
|
| -
|
| HInstruction* load = is_fast_elements
|
| ? BuildLoadKeyedFastElement(obj, key, prop)
|
| : BuildLoadKeyedGeneric(obj, key);
|
| @@ -3677,7 +3683,9 @@ HInstruction* HGraphBuilder::BuildLoadNamedGeneric(HValue* obj,
|
| Property* expr) {
|
| ASSERT(expr->key()->IsPropertyName());
|
| Handle<Object> name = expr->key()->AsLiteral()->handle();
|
| - return new HLoadNamedGeneric(obj, name);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + return new HLoadNamedGeneric(context, obj, name);
|
| }
|
|
|
|
|
| @@ -3706,7 +3714,9 @@ HInstruction* HGraphBuilder::BuildLoadNamed(HValue* obj,
|
|
|
| HInstruction* HGraphBuilder::BuildLoadKeyedGeneric(HValue* object,
|
| HValue* key) {
|
| - return new HLoadKeyedGeneric(object, key);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + return new HLoadKeyedGeneric(context, object, key);
|
| }
|
|
|
|
|
| @@ -3737,7 +3747,9 @@ HInstruction* HGraphBuilder::BuildLoadKeyedFastElement(HValue* object,
|
| HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object,
|
| HValue* key,
|
| HValue* value) {
|
| - return new HStoreKeyedGeneric(object, key, value);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + return new HStoreKeyedGeneric(context, object, key, value);
|
| }
|
|
|
|
|
| @@ -3916,7 +3928,9 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr,
|
| // If we couldn't compute the target for any of the maps just perform an
|
| // IC call.
|
| if (maps.length() == 0) {
|
| - HCall* call = new HCallNamed(name, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCall* call = new HCallNamed(context, name, argument_count);
|
| call->set_position(expr->position());
|
| ProcessCall(call);
|
| ast_context()->ReturnInstruction(call, expr->id());
|
| @@ -3928,7 +3942,9 @@ void HGraphBuilder::HandlePolymorphicCallNamed(Call* expr,
|
| if (!needs_generic && FLAG_deoptimize_uncommon_cases) {
|
| subgraph->FinishExit(new HDeoptimize());
|
| } else {
|
| - HCall* call = new HCallNamed(name, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCall* call = new HCallNamed(context, name, argument_count);
|
| call->set_position(expr->position());
|
| ProcessCall(call);
|
| PushAndAdd(call);
|
| @@ -4348,7 +4364,9 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| VisitArgumentList(expr->arguments());
|
| CHECK_BAILOUT;
|
|
|
| - call = new HCallKeyed(key, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + call = new HCallKeyed(context, key, argument_count);
|
| call->set_position(expr->position());
|
| ProcessCall(call);
|
| Drop(1); // Key.
|
| @@ -4387,7 +4405,9 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| // When the target has a custom call IC generator, use the IC,
|
| // because it is likely to generate better code. Also use the
|
| // IC when a primitive receiver check is required.
|
| - call = new HCallNamed(name, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + call = new HCallNamed(context, name, argument_count);
|
| } else {
|
| AddCheckConstantFunction(expr, receiver, receiver_map, true);
|
|
|
| @@ -4416,7 +4436,9 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| return;
|
|
|
| } else {
|
| - call = new HCallNamed(name, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + call = new HCallNamed(context, name, argument_count);
|
| }
|
|
|
| } else {
|
| @@ -4486,7 +4508,7 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| VisitArgumentList(expr->arguments());
|
| CHECK_BAILOUT;
|
|
|
| - call = new HCallGlobal(var->name(), argument_count);
|
| + call = new HCallGlobal(context, var->name(), argument_count);
|
| }
|
|
|
| } else {
|
| @@ -4498,7 +4520,7 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| VisitArgumentList(expr->arguments());
|
| CHECK_BAILOUT;
|
|
|
| - call = new HCallFunction(argument_count);
|
| + call = new HCallFunction(context, argument_count);
|
| }
|
| }
|
|
|
| @@ -4517,7 +4539,9 @@ void HGraphBuilder::VisitCallNew(CallNew* expr) {
|
| CHECK_BAILOUT;
|
|
|
| int argument_count = expr->arguments()->length() + 1; // Plus constructor.
|
| - HCall* call = new HCallNew(argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCall* call = new HCallNew(context, argument_count);
|
| call->set_position(expr->position());
|
| ProcessCall(call);
|
| ast_context()->ReturnInstruction(call, expr->id());
|
| @@ -4785,7 +4809,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
|
|
| HInstruction* store = is_fast_elements
|
| ? BuildStoreKeyedFastElement(obj, key, after, prop)
|
| - : new HStoreKeyedGeneric(obj, key, after);
|
| + : BuildStoreKeyedGeneric(obj, key, after);
|
| AddInstruction(store);
|
|
|
| // Drop the key from the bailout environment. Overwrite the receiver
|
| @@ -5042,7 +5066,9 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| // If the target is not null we have found a known global function that is
|
| // assumed to stay the same for this instanceof.
|
| if (target.is_null()) {
|
| - instr = new HInstanceOf(left, right);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + instr = new HInstanceOf(context, left, right);
|
| } else {
|
| AddInstruction(new HCheckFunction(right, target));
|
| instr = new HInstanceOfKnownGlobal(left, target);
|
| @@ -5253,7 +5279,10 @@ void HGraphBuilder::GenerateStringCharFromCode(int argument_count,
|
| void HGraphBuilder::GenerateStringCharAt(int argument_count, int ast_id) {
|
| ASSERT_EQ(2, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| - HCallStub* result = new HCallStub(CodeStub::StringCharAt, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCallStub* result =
|
| + new HCallStub(context, CodeStub::StringCharAt, argument_count);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
|
|
| @@ -5283,7 +5312,10 @@ void HGraphBuilder::GenerateRandomHeapNumber(int argument_count, int ast_id) {
|
| void HGraphBuilder::GenerateStringAdd(int argument_count, int ast_id) {
|
| ASSERT_EQ(2, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| - HCallStub* result = new HCallStub(CodeStub::StringAdd, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCallStub* result =
|
| + new HCallStub(context, CodeStub::StringAdd, argument_count);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
|
|
| @@ -5292,7 +5324,10 @@ void HGraphBuilder::GenerateStringAdd(int argument_count, int ast_id) {
|
| void HGraphBuilder::GenerateSubString(int argument_count, int ast_id) {
|
| ASSERT_EQ(3, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| - HCallStub* result = new HCallStub(CodeStub::SubString, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCallStub* result =
|
| + new HCallStub(context, CodeStub::SubString, argument_count);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
|
|
| @@ -5301,7 +5336,10 @@ void HGraphBuilder::GenerateSubString(int argument_count, int ast_id) {
|
| void HGraphBuilder::GenerateStringCompare(int argument_count, int ast_id) {
|
| ASSERT_EQ(2, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| - HCallStub* result = new HCallStub(CodeStub::StringCompare, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCallStub* result =
|
| + new HCallStub(context, CodeStub::StringCompare, argument_count);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
|
|
| @@ -5310,7 +5348,10 @@ void HGraphBuilder::GenerateStringCompare(int argument_count, int ast_id) {
|
| void HGraphBuilder::GenerateRegExpExec(int argument_count, int ast_id) {
|
| ASSERT_EQ(4, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| - HCallStub* result = new HCallStub(CodeStub::RegExpExec, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCallStub* result =
|
| + new HCallStub(context, CodeStub::RegExpExec, argument_count);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
|
|
| @@ -5320,8 +5361,10 @@ void HGraphBuilder::GenerateRegExpConstructResult(int argument_count,
|
| int ast_id) {
|
| ASSERT_EQ(3, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| HCallStub* result =
|
| - new HCallStub(CodeStub::RegExpConstructResult, argument_count);
|
| + new HCallStub(context,CodeStub::RegExpConstructResult, argument_count);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
|
|
| @@ -5336,7 +5379,10 @@ void HGraphBuilder::GenerateGetFromCache(int argument_count, int ast_id) {
|
| void HGraphBuilder::GenerateNumberToString(int argument_count, int ast_id) {
|
| ASSERT_EQ(1, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| - HCallStub* result = new HCallStub(CodeStub::NumberToString, argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| + HCallStub* result =
|
| + new HCallStub(context, CodeStub::NumberToString, argument_count);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
|
|
| @@ -5368,8 +5414,10 @@ void HGraphBuilder::GenerateMathPow(int argument_count, int ast_id) {
|
| void HGraphBuilder::GenerateMathSin(int argument_count, int ast_id) {
|
| ASSERT_EQ(1, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| HCallStub* result =
|
| - new HCallStub(CodeStub::TranscendentalCache, argument_count);
|
| + new HCallStub(context, CodeStub::TranscendentalCache, argument_count);
|
| result->set_transcendental_type(TranscendentalCache::SIN);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
| @@ -5378,8 +5426,10 @@ void HGraphBuilder::GenerateMathSin(int argument_count, int ast_id) {
|
| void HGraphBuilder::GenerateMathCos(int argument_count, int ast_id) {
|
| ASSERT_EQ(1, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| HCallStub* result =
|
| - new HCallStub(CodeStub::TranscendentalCache, argument_count);
|
| + new HCallStub(context, CodeStub::TranscendentalCache, argument_count);
|
| result->set_transcendental_type(TranscendentalCache::COS);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
| @@ -5388,8 +5438,10 @@ void HGraphBuilder::GenerateMathCos(int argument_count, int ast_id) {
|
| void HGraphBuilder::GenerateMathLog(int argument_count, int ast_id) {
|
| ASSERT_EQ(1, argument_count);
|
| PushArgumentsForStubCall(argument_count);
|
| + HContext* context = new HContext;
|
| + AddInstruction(context);
|
| HCallStub* result =
|
| - new HCallStub(CodeStub::TranscendentalCache, argument_count);
|
| + new HCallStub(context, CodeStub::TranscendentalCache, argument_count);
|
| result->set_transcendental_type(TranscendentalCache::LOG);
|
| ast_context()->ReturnInstruction(result, ast_id);
|
| }
|
|
|