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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 base_object()->PrintTo(stream); | 265 base_object()->PrintTo(stream); |
266 stream->Add(" + %d", offset()); | 266 stream->Add(" + %d", offset()); |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 270 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
271 stream->Add("#%d / ", arity()); | 271 stream->Add("#%d / ", arity()); |
272 } | 272 } |
273 | 273 |
274 | 274 |
275 ExternalReference LLinkObjectInList::GetReference(Isolate* isolate) { | |
276 switch (hydrogen()->known_list()) { | |
277 case HLinkObjectInList::ALLOCATION_SITE_LIST: | |
278 return ExternalReference::allocation_sites_list_address(isolate); | |
279 } | |
280 | |
281 UNREACHABLE(); | |
282 // Return a dummy value | |
283 return ExternalReference::isolate_address(isolate); | |
284 } | |
285 | |
286 | |
287 void LLinkObjectInList::PrintDataTo(StringStream* stream) { | |
288 object()->PrintTo(stream); | |
289 stream->Add(" offset %d", hydrogen()->store_field().offset()); | |
290 } | |
291 | |
292 | |
293 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 275 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
294 context()->PrintTo(stream); | 276 context()->PrintTo(stream); |
295 stream->Add("[%d]", slot_index()); | 277 stream->Add("[%d]", slot_index()); |
296 } | 278 } |
297 | 279 |
298 | 280 |
299 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 281 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
300 context()->PrintTo(stream); | 282 context()->PrintTo(stream); |
301 stream->Add("[%d] <- ", slot_index()); | 283 stream->Add("[%d] <- ", slot_index()); |
302 value()->PrintTo(stream); | 284 value()->PrintTo(stream); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 HBasicBlock* next = NULL; | 430 HBasicBlock* next = NULL; |
449 if (i < blocks->length() - 1) next = blocks->at(i + 1); | 431 if (i < blocks->length() - 1) next = blocks->at(i + 1); |
450 DoBasicBlock(blocks->at(i), next); | 432 DoBasicBlock(blocks->at(i), next); |
451 if (is_aborted()) return NULL; | 433 if (is_aborted()) return NULL; |
452 } | 434 } |
453 status_ = DONE; | 435 status_ = DONE; |
454 return chunk_; | 436 return chunk_; |
455 } | 437 } |
456 | 438 |
457 | 439 |
458 void LChunkBuilder::Abort(const char* reason) { | 440 void LChunkBuilder::Abort(BailoutReason reason) { |
459 info()->set_bailout_reason(reason); | 441 info()->set_bailout_reason(reason); |
460 status_ = ABORTED; | 442 status_ = ABORTED; |
461 } | 443 } |
462 | 444 |
463 | 445 |
464 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { | 446 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { |
465 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, | 447 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, |
466 Register::ToAllocationIndex(reg)); | 448 Register::ToAllocationIndex(reg)); |
467 } | 449 } |
468 | 450 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); | 638 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); |
657 return instr; | 639 return instr; |
658 } | 640 } |
659 | 641 |
660 | 642 |
661 LUnallocated* LChunkBuilder::TempRegister() { | 643 LUnallocated* LChunkBuilder::TempRegister() { |
662 LUnallocated* operand = | 644 LUnallocated* operand = |
663 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 645 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
664 int vreg = allocator_->GetVirtualRegister(); | 646 int vreg = allocator_->GetVirtualRegister(); |
665 if (!allocator_->AllocationOk()) { | 647 if (!allocator_->AllocationOk()) { |
666 Abort("Out of virtual registers while trying to allocate temp register."); | 648 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
667 vreg = 0; | 649 vreg = 0; |
668 } | 650 } |
669 operand->set_virtual_register(vreg); | 651 operand->set_virtual_register(vreg); |
670 return operand; | 652 return operand; |
671 } | 653 } |
672 | 654 |
673 | 655 |
674 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 656 LOperand* LChunkBuilder::FixedTemp(Register reg) { |
675 LUnallocated* operand = ToUnallocated(reg); | 657 LUnallocated* operand = ToUnallocated(reg); |
676 ASSERT(operand->HasFixedPolicy()); | 658 ASSERT(operand->HasFixedPolicy()); |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 | 2070 |
2089 | 2071 |
2090 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 2072 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
2091 Representation r = instr->representation(); | 2073 Representation r = instr->representation(); |
2092 if (r.IsSmi()) { | 2074 if (r.IsSmi()) { |
2093 return DefineAsRegister(new(zone()) LConstantS); | 2075 return DefineAsRegister(new(zone()) LConstantS); |
2094 } else if (r.IsInteger32()) { | 2076 } else if (r.IsInteger32()) { |
2095 return DefineAsRegister(new(zone()) LConstantI); | 2077 return DefineAsRegister(new(zone()) LConstantI); |
2096 } else if (r.IsDouble()) { | 2078 } else if (r.IsDouble()) { |
2097 return DefineAsRegister(new(zone()) LConstantD); | 2079 return DefineAsRegister(new(zone()) LConstantD); |
| 2080 } else if (r.IsExternal()) { |
| 2081 return DefineAsRegister(new(zone()) LConstantE); |
2098 } else if (r.IsTagged()) { | 2082 } else if (r.IsTagged()) { |
2099 return DefineAsRegister(new(zone()) LConstantT); | 2083 return DefineAsRegister(new(zone()) LConstantT); |
2100 } else { | 2084 } else { |
2101 UNREACHABLE(); | 2085 UNREACHABLE(); |
2102 return NULL; | 2086 return NULL; |
2103 } | 2087 } |
2104 } | 2088 } |
2105 | 2089 |
2106 | 2090 |
2107 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { | 2091 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
(...skipping 23 matching lines...) Expand all Loading... |
2131 | 2115 |
2132 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | 2116 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { |
2133 LOperand* global_object = UseFixed(instr->global_object(), r1); | 2117 LOperand* global_object = UseFixed(instr->global_object(), r1); |
2134 LOperand* value = UseFixed(instr->value(), r0); | 2118 LOperand* value = UseFixed(instr->value(), r0); |
2135 LStoreGlobalGeneric* result = | 2119 LStoreGlobalGeneric* result = |
2136 new(zone()) LStoreGlobalGeneric(global_object, value); | 2120 new(zone()) LStoreGlobalGeneric(global_object, value); |
2137 return MarkAsCall(result, instr); | 2121 return MarkAsCall(result, instr); |
2138 } | 2122 } |
2139 | 2123 |
2140 | 2124 |
2141 LInstruction* LChunkBuilder::DoLinkObjectInList(HLinkObjectInList* instr) { | |
2142 LOperand* object = UseRegister(instr->value()); | |
2143 LLinkObjectInList* result = new(zone()) LLinkObjectInList(object); | |
2144 return result; | |
2145 } | |
2146 | |
2147 | |
2148 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 2125 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
2149 LOperand* context = UseRegisterAtStart(instr->value()); | 2126 LOperand* context = UseRegisterAtStart(instr->value()); |
2150 LInstruction* result = | 2127 LInstruction* result = |
2151 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 2128 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
2152 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2129 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
2153 } | 2130 } |
2154 | 2131 |
2155 | 2132 |
2156 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { | 2133 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { |
2157 LOperand* context; | 2134 LOperand* context; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 } | 2386 } |
2410 | 2387 |
2411 | 2388 |
2412 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2389 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
2413 LOperand* char_code = UseRegister(instr->value()); | 2390 LOperand* char_code = UseRegister(instr->value()); |
2414 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); | 2391 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); |
2415 return AssignPointerMap(DefineAsRegister(result)); | 2392 return AssignPointerMap(DefineAsRegister(result)); |
2416 } | 2393 } |
2417 | 2394 |
2418 | 2395 |
2419 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | |
2420 LOperand* string = UseRegisterAtStart(instr->value()); | |
2421 return DefineAsRegister(new(zone()) LStringLength(string)); | |
2422 } | |
2423 | |
2424 | |
2425 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { | 2396 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { |
2426 info()->MarkAsDeferredCalling(); | 2397 info()->MarkAsDeferredCalling(); |
2427 LOperand* size = instr->size()->IsConstant() | 2398 LOperand* size = instr->size()->IsConstant() |
2428 ? UseConstant(instr->size()) | 2399 ? UseConstant(instr->size()) |
2429 : UseTempRegister(instr->size()); | 2400 : UseTempRegister(instr->size()); |
2430 LOperand* temp1 = TempRegister(); | 2401 LOperand* temp1 = TempRegister(); |
2431 LOperand* temp2 = TempRegister(); | 2402 LOperand* temp2 = TempRegister(); |
2432 LAllocate* result = new(zone()) LAllocate(size, temp1, temp2); | 2403 LAllocate* result = new(zone()) LAllocate(size, temp1, temp2); |
2433 return AssignPointerMap(DefineAsRegister(result)); | 2404 return AssignPointerMap(DefineAsRegister(result)); |
2434 } | 2405 } |
(...skipping 29 matching lines...) Expand all Loading... |
2464 int index = static_cast<int>(instr->index()); | 2435 int index = static_cast<int>(instr->index()); |
2465 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); | 2436 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); |
2466 return DefineFixed(result, reg); | 2437 return DefineFixed(result, reg); |
2467 } | 2438 } |
2468 } | 2439 } |
2469 | 2440 |
2470 | 2441 |
2471 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2442 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
2472 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. | 2443 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. |
2473 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2444 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2474 Abort("Too many spill slots needed for OSR"); | 2445 Abort(kTooManySpillSlotsNeededForOSR); |
2475 spill_index = 0; | 2446 spill_index = 0; |
2476 } | 2447 } |
2477 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2448 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2478 } | 2449 } |
2479 | 2450 |
2480 | 2451 |
2481 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2452 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
2482 argument_count_ -= instr->argument_count(); | 2453 argument_count_ -= instr->argument_count(); |
2483 return MarkAsCall(DefineFixed(new(zone()) LCallStub, r0), instr); | 2454 return MarkAsCall(DefineFixed(new(zone()) LCallStub, r0), instr); |
2484 } | 2455 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 | 2608 |
2638 | 2609 |
2639 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2610 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2640 LOperand* object = UseRegister(instr->object()); | 2611 LOperand* object = UseRegister(instr->object()); |
2641 LOperand* index = UseRegister(instr->index()); | 2612 LOperand* index = UseRegister(instr->index()); |
2642 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2613 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2643 } | 2614 } |
2644 | 2615 |
2645 | 2616 |
2646 } } // namespace v8::internal | 2617 } } // namespace v8::internal |
OLD | NEW |