| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 257 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
| 258 stream->Add("if typeof "); | 258 stream->Add("if typeof "); |
| 259 value()->PrintTo(stream); | 259 value()->PrintTo(stream); |
| 260 stream->Add(" == \"%s\" then B%d else B%d", | 260 stream->Add(" == \"%s\" then B%d else B%d", |
| 261 *hydrogen()->type_literal()->ToCString(), | 261 *hydrogen()->type_literal()->ToCString(), |
| 262 true_block_id(), false_block_id()); | 262 true_block_id(), false_block_id()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 | 265 |
| 266 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { |
| 267 stream->Add(" = "); |
| 268 function()->PrintTo(stream); |
| 269 stream->Add(".code_entry = "); |
| 270 code_object()->PrintTo(stream); |
| 271 } |
| 272 |
| 273 |
| 266 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 274 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
| 267 stream->Add(" = "); | 275 stream->Add(" = "); |
| 268 base_object()->PrintTo(stream); | 276 base_object()->PrintTo(stream); |
| 269 stream->Add(" + %d", offset()); | 277 stream->Add(" + %d", offset()); |
| 270 } | 278 } |
| 271 | 279 |
| 272 | 280 |
| 273 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 281 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 274 stream->Add("#%d / ", arity()); | 282 stream->Add("#%d / ", arity()); |
| 275 } | 283 } |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 right = UseFixed(right_value, rcx); | 735 right = UseFixed(right_value, rcx); |
| 728 } | 736 } |
| 729 | 737 |
| 730 // Shift operations can only deoptimize if we do a logical shift by 0 and | 738 // Shift operations can only deoptimize if we do a logical shift by 0 and |
| 731 // the result cannot be truncated to int32. | 739 // the result cannot be truncated to int32. |
| 732 bool does_deopt = false; | 740 bool does_deopt = false; |
| 733 if (op == Token::SHR && constant_value == 0) { | 741 if (op == Token::SHR && constant_value == 0) { |
| 734 if (FLAG_opt_safe_uint32_operations) { | 742 if (FLAG_opt_safe_uint32_operations) { |
| 735 does_deopt = !instr->CheckFlag(HInstruction::kUint32); | 743 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
| 736 } else { | 744 } else { |
| 737 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 745 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32); |
| 738 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | |
| 739 does_deopt = true; | |
| 740 break; | |
| 741 } | |
| 742 } | |
| 743 } | 746 } |
| 744 } | 747 } |
| 745 | 748 |
| 746 LInstruction* result = | 749 LInstruction* result = |
| 747 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); | 750 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); |
| 748 return does_deopt ? AssignEnvironment(result) : result; | 751 return does_deopt ? AssignEnvironment(result) : result; |
| 749 } | 752 } |
| 750 | 753 |
| 751 | 754 |
| 752 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, | 755 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 } | 1084 } |
| 1082 | 1085 |
| 1083 | 1086 |
| 1084 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { | 1087 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { |
| 1085 ++argument_count_; | 1088 ++argument_count_; |
| 1086 LOperand* argument = UseOrConstant(instr->argument()); | 1089 LOperand* argument = UseOrConstant(instr->argument()); |
| 1087 return new(zone()) LPushArgument(argument); | 1090 return new(zone()) LPushArgument(argument); |
| 1088 } | 1091 } |
| 1089 | 1092 |
| 1090 | 1093 |
| 1094 LInstruction* LChunkBuilder::DoStoreCodeEntry( |
| 1095 HStoreCodeEntry* store_code_entry) { |
| 1096 LOperand* function = UseRegister(store_code_entry->function()); |
| 1097 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); |
| 1098 return new(zone()) LStoreCodeEntry(function, code_object); |
| 1099 } |
| 1100 |
| 1101 |
| 1091 LInstruction* LChunkBuilder::DoInnerAllocatedObject( | 1102 LInstruction* LChunkBuilder::DoInnerAllocatedObject( |
| 1092 HInnerAllocatedObject* inner_object) { | 1103 HInnerAllocatedObject* inner_object) { |
| 1093 LOperand* base_object = UseRegisterAtStart(inner_object->base_object()); | 1104 LOperand* base_object = UseRegisterAtStart(inner_object->base_object()); |
| 1094 LInnerAllocatedObject* result = | 1105 LInnerAllocatedObject* result = |
| 1095 new(zone()) LInnerAllocatedObject(base_object); | 1106 new(zone()) LInnerAllocatedObject(base_object); |
| 1096 return DefineAsRegister(result); | 1107 return DefineAsRegister(result); |
| 1097 } | 1108 } |
| 1098 | 1109 |
| 1099 | 1110 |
| 1100 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 1111 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2383 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
| 2373 // There are no real uses of the arguments object. | 2384 // There are no real uses of the arguments object. |
| 2374 // arguments.length and element access are supported directly on | 2385 // arguments.length and element access are supported directly on |
| 2375 // stack arguments, and any real arguments object use causes a bailout. | 2386 // stack arguments, and any real arguments object use causes a bailout. |
| 2376 // So this value is never used. | 2387 // So this value is never used. |
| 2377 return NULL; | 2388 return NULL; |
| 2378 } | 2389 } |
| 2379 | 2390 |
| 2380 | 2391 |
| 2381 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) { | 2392 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) { |
| 2393 instr->ReplayEnvironment(current_block_->last_environment()); |
| 2394 |
| 2382 // There are no real uses of a captured object. | 2395 // There are no real uses of a captured object. |
| 2383 return NULL; | 2396 return NULL; |
| 2384 } | 2397 } |
| 2385 | 2398 |
| 2386 | 2399 |
| 2387 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { | 2400 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { |
| 2388 info()->MarkAsRequiresFrame(); | 2401 info()->MarkAsRequiresFrame(); |
| 2389 LOperand* args = UseRegister(instr->arguments()); | 2402 LOperand* args = UseRegister(instr->arguments()); |
| 2390 LOperand* length; | 2403 LOperand* length; |
| 2391 LOperand* index; | 2404 LOperand* index; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2418 } | 2431 } |
| 2419 | 2432 |
| 2420 | 2433 |
| 2421 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2434 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2422 HIsConstructCallAndBranch* instr) { | 2435 HIsConstructCallAndBranch* instr) { |
| 2423 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2436 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2424 } | 2437 } |
| 2425 | 2438 |
| 2426 | 2439 |
| 2427 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2440 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
| 2428 HEnvironment* env = current_block_->last_environment(); | 2441 instr->ReplayEnvironment(current_block_->last_environment()); |
| 2429 ASSERT(env != NULL); | |
| 2430 | |
| 2431 env->set_ast_id(instr->ast_id()); | |
| 2432 | |
| 2433 env->Drop(instr->pop_count()); | |
| 2434 for (int i = instr->values()->length() - 1; i >= 0; --i) { | |
| 2435 HValue* value = instr->values()->at(i); | |
| 2436 if (instr->HasAssignedIndexAt(i)) { | |
| 2437 env->Bind(instr->GetAssignedIndexAt(i), value); | |
| 2438 } else { | |
| 2439 env->Push(value); | |
| 2440 } | |
| 2441 } | |
| 2442 | 2442 |
| 2443 // If there is an instruction pending deoptimization environment create a | 2443 // If there is an instruction pending deoptimization environment create a |
| 2444 // lazy bailout instruction to capture the environment. | 2444 // lazy bailout instruction to capture the environment. |
| 2445 if (pending_deoptimization_ast_id_ == instr->ast_id()) { | 2445 if (pending_deoptimization_ast_id_ == instr->ast_id()) { |
| 2446 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; | 2446 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; |
| 2447 LInstruction* result = AssignEnvironment(lazy_bailout); | 2447 LInstruction* result = AssignEnvironment(lazy_bailout); |
| 2448 // Store the lazy deopt environment with the instruction if needed. Right | 2448 // Store the lazy deopt environment with the instruction if needed. Right |
| 2449 // now it is only used for LInstanceOfKnownGlobal. | 2449 // now it is only used for LInstanceOfKnownGlobal. |
| 2450 instruction_pending_deoptimization_environment_-> | 2450 instruction_pending_deoptimization_environment_-> |
| 2451 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | 2451 SetDeferredLazyDeoptimizationEnvironment(result->environment()); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2532 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2532 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2533 LOperand* object = UseRegister(instr->object()); | 2533 LOperand* object = UseRegister(instr->object()); |
| 2534 LOperand* index = UseTempRegister(instr->index()); | 2534 LOperand* index = UseTempRegister(instr->index()); |
| 2535 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2535 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2536 } | 2536 } |
| 2537 | 2537 |
| 2538 | 2538 |
| 2539 } } // namespace v8::internal | 2539 } } // namespace v8::internal |
| 2540 | 2540 |
| 2541 #endif // V8_TARGET_ARCH_X64 | 2541 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |