| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 | 285 |
| 286 | 286 |
| 287 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 287 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 288 context()->PrintTo(stream); | 288 context()->PrintTo(stream); |
| 289 stream->Add("[%d]", slot_index()); | 289 stream->Add("[%d]", slot_index()); |
| 290 } | 290 } |
| 291 | 291 |
| 292 | 292 |
| 293 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { |
| 294 stream->Add(" = "); |
| 295 function()->PrintTo(stream); |
| 296 stream->Add(".code_entry = "); |
| 297 code_object()->PrintTo(stream); |
| 298 } |
| 299 |
| 300 |
| 293 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 301 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
| 294 context()->PrintTo(stream); | 302 context()->PrintTo(stream); |
| 295 stream->Add("[%d] <- ", slot_index()); | 303 stream->Add("[%d] <- ", slot_index()); |
| 296 value()->PrintTo(stream); | 304 value()->PrintTo(stream); |
| 297 } | 305 } |
| 298 | 306 |
| 299 | 307 |
| 300 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { | 308 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 301 object()->PrintTo(stream); | 309 object()->PrintTo(stream); |
| 302 stream->Add("["); | 310 stream->Add("["); |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 } | 1115 } |
| 1108 | 1116 |
| 1109 | 1117 |
| 1110 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 1118 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
| 1111 argument_count_ -= instr->argument_count(); | 1119 argument_count_ -= instr->argument_count(); |
| 1112 return MarkAsCall(DefineFixed(new(zone()) LCallStub, x0), instr); | 1120 return MarkAsCall(DefineFixed(new(zone()) LCallStub, x0), instr); |
| 1113 } | 1121 } |
| 1114 | 1122 |
| 1115 | 1123 |
| 1116 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) { | 1124 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) { |
| 1125 instr->ReplayEnvironment(current_block_->last_environment()); |
| 1126 |
| 1117 // There are no real uses of a captured object. | 1127 // There are no real uses of a captured object. |
| 1118 return NULL; | 1128 return NULL; |
| 1119 } | 1129 } |
| 1120 | 1130 |
| 1121 | 1131 |
| 1122 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 1132 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
| 1123 Representation from = instr->from(); | 1133 Representation from = instr->from(); |
| 1124 Representation to = instr->to(); | 1134 Representation to = instr->to(); |
| 1125 | 1135 |
| 1126 if (from.IsSmi()) { | 1136 if (from.IsSmi()) { |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 right = UseRegisterAtStart(right_value); | 2024 right = UseRegisterAtStart(right_value); |
| 2015 } | 2025 } |
| 2016 | 2026 |
| 2017 // Shift operations can only deoptimize if we do a logical shift by 0 and the | 2027 // Shift operations can only deoptimize if we do a logical shift by 0 and the |
| 2018 // result cannot be truncated to int32. | 2028 // result cannot be truncated to int32. |
| 2019 bool does_deopt = false; | 2029 bool does_deopt = false; |
| 2020 if ((op == Token::SHR) && (constant_value == 0)) { | 2030 if ((op == Token::SHR) && (constant_value == 0)) { |
| 2021 if (FLAG_opt_safe_uint32_operations) { | 2031 if (FLAG_opt_safe_uint32_operations) { |
| 2022 does_deopt = !instr->CheckFlag(HInstruction::kUint32); | 2032 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
| 2023 } else { | 2033 } else { |
| 2024 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 2034 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32); |
| 2025 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { | |
| 2026 does_deopt = true; | |
| 2027 break; | |
| 2028 } | |
| 2029 } | |
| 2030 } | 2035 } |
| 2031 } | 2036 } |
| 2032 | 2037 |
| 2033 LInstruction* result = | 2038 LInstruction* result = |
| 2034 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); | 2039 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); |
| 2035 return does_deopt ? AssignEnvironment(result) : result; | 2040 return does_deopt ? AssignEnvironment(result) : result; |
| 2036 } | 2041 } |
| 2037 | 2042 |
| 2038 | 2043 |
| 2039 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 2044 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2050 return DoShift(Token::SHL, instr); | 2055 return DoShift(Token::SHL, instr); |
| 2051 } | 2056 } |
| 2052 | 2057 |
| 2053 | 2058 |
| 2054 LInstruction* LChunkBuilder::DoShr(HShr* instr) { | 2059 LInstruction* LChunkBuilder::DoShr(HShr* instr) { |
| 2055 return DoShift(Token::SHR, instr); | 2060 return DoShift(Token::SHR, instr); |
| 2056 } | 2061 } |
| 2057 | 2062 |
| 2058 | 2063 |
| 2059 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2064 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
| 2060 HEnvironment* env = current_block_->last_environment(); | 2065 instr->ReplayEnvironment(current_block_->last_environment()); |
| 2061 ASSERT(env != NULL); | |
| 2062 | |
| 2063 env->set_ast_id(instr->ast_id()); | |
| 2064 | |
| 2065 env->Drop(instr->pop_count()); | |
| 2066 for (int i = instr->values()->length() - 1; i >= 0; --i) { | |
| 2067 HValue* value = instr->values()->at(i); | |
| 2068 if (instr->HasAssignedIndexAt(i)) { | |
| 2069 env->Bind(instr->GetAssignedIndexAt(i), value); | |
| 2070 } else { | |
| 2071 env->Push(value); | |
| 2072 } | |
| 2073 } | |
| 2074 | 2066 |
| 2075 // If there is an instruction pending deoptimization environment create a | 2067 // If there is an instruction pending deoptimization environment create a |
| 2076 // lazy bailout instruction to capture the environment. | 2068 // lazy bailout instruction to capture the environment. |
| 2077 if (pending_deoptimization_ast_id_ == instr->ast_id()) { | 2069 if (pending_deoptimization_ast_id_ == instr->ast_id()) { |
| 2078 LInstruction* result = new(zone()) LLazyBailout; | 2070 LInstruction* result = new(zone()) LLazyBailout; |
| 2079 result = AssignEnvironment(result); | 2071 result = AssignEnvironment(result); |
| 2080 // Store the lazy deopt environment with the instruction if needed. Right | 2072 // Store the lazy deopt environment with the instruction if needed. Right |
| 2081 // now it is only used for LInstanceOfKnownGlobal. | 2073 // now it is only used for LInstanceOfKnownGlobal. |
| 2082 instruction_pending_deoptimization_environment_-> | 2074 instruction_pending_deoptimization_environment_-> |
| 2083 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | 2075 SetDeferredLazyDeoptimizationEnvironment(result->environment()); |
| 2084 instruction_pending_deoptimization_environment_ = NULL; | 2076 instruction_pending_deoptimization_environment_ = NULL; |
| 2085 pending_deoptimization_ast_id_ = BailoutId::None(); | 2077 pending_deoptimization_ast_id_ = BailoutId::None(); |
| 2086 return result; | 2078 return result; |
| 2087 } | 2079 } |
| 2088 | 2080 |
| 2089 return NULL; | 2081 return NULL; |
| 2090 } | 2082 } |
| 2091 | 2083 |
| 2092 | 2084 |
| 2093 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2085 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
| 2094 if (instr->is_function_entry()) { | 2086 if (instr->is_function_entry()) { |
| 2095 return MarkAsCall(new(zone()) LStackCheck, instr); | 2087 return MarkAsCall(new(zone()) LStackCheck, instr); |
| 2096 } else { | 2088 } else { |
| 2097 ASSERT(instr->is_backwards_branch()); | 2089 ASSERT(instr->is_backwards_branch()); |
| 2098 return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck)); | 2090 return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck)); |
| 2099 } | 2091 } |
| 2100 } | 2092 } |
| 2101 | 2093 |
| 2102 | 2094 |
| 2095 LInstruction* LChunkBuilder::DoStoreCodeEntry(HStoreCodeEntry* instr) { |
| 2096 LOperand* function = UseRegister(instr->function()); |
| 2097 LOperand* code_object = UseRegisterAtStart(instr->code_object()); |
| 2098 LOperand* temp = TempRegister(); |
| 2099 return new(zone()) LStoreCodeEntry(function, code_object, temp); |
| 2100 } |
| 2101 |
| 2102 |
| 2103 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { | 2103 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { |
| 2104 LOperand* temp = TempRegister(); | 2104 LOperand* temp = TempRegister(); |
| 2105 LOperand* context; | 2105 LOperand* context; |
| 2106 LOperand* value; | 2106 LOperand* value; |
| 2107 if (instr->NeedsWriteBarrier()) { | 2107 if (instr->NeedsWriteBarrier()) { |
| 2108 // TODO(all): Replace these constraints when RecordWriteStub has been | 2108 // TODO(all): Replace these constraints when RecordWriteStub has been |
| 2109 // rewritten. | 2109 // rewritten. |
| 2110 context = UseRegisterAndClobber(instr->context()); | 2110 context = UseRegisterAndClobber(instr->context()); |
| 2111 value = UseRegisterAndClobber(instr->value()); | 2111 value = UseRegisterAndClobber(instr->value()); |
| 2112 } else { | 2112 } else { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2531 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2532 LOperand* receiver = UseRegister(instr->receiver()); | 2532 LOperand* receiver = UseRegister(instr->receiver()); |
| 2533 LOperand* function = UseRegisterAtStart(instr->function()); | 2533 LOperand* function = UseRegisterAtStart(instr->function()); |
| 2534 LOperand* temp = TempRegister(); | 2534 LOperand* temp = TempRegister(); |
| 2535 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); | 2535 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); |
| 2536 return AssignEnvironment(DefineAsRegister(result)); | 2536 return AssignEnvironment(DefineAsRegister(result)); |
| 2537 } | 2537 } |
| 2538 | 2538 |
| 2539 | 2539 |
| 2540 } } // namespace v8::internal | 2540 } } // namespace v8::internal |
| OLD | NEW |