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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 base_object()->PrintTo(stream); | 270 base_object()->PrintTo(stream); |
271 stream->Add(" + %d", offset()); | 271 stream->Add(" + %d", offset()); |
272 } | 272 } |
273 | 273 |
274 | 274 |
275 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 275 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
276 stream->Add("#%d / ", arity()); | 276 stream->Add("#%d / ", arity()); |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 ExternalReference LLinkObjectInList::GetReference(Isolate* isolate) { | |
281 switch (hydrogen()->known_list()) { | |
282 case HLinkObjectInList::ALLOCATION_SITE_LIST: | |
283 return ExternalReference::allocation_sites_list_address(isolate); | |
284 } | |
285 | |
286 UNREACHABLE(); | |
287 // Return a dummy value | |
288 return ExternalReference::isolate_address(isolate); | |
289 } | |
290 | |
291 | |
292 void LLinkObjectInList::PrintDataTo(StringStream* stream) { | |
293 object()->PrintTo(stream); | |
294 stream->Add(" offset %d", hydrogen()->store_field().offset()); | |
295 } | |
296 | |
297 | |
298 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 280 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
299 context()->PrintTo(stream); | 281 context()->PrintTo(stream); |
300 stream->Add("[%d]", slot_index()); | 282 stream->Add("[%d]", slot_index()); |
301 } | 283 } |
302 | 284 |
303 | 285 |
304 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 286 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
305 context()->PrintTo(stream); | 287 context()->PrintTo(stream); |
306 stream->Add("[%d] <- ", slot_index()); | 288 stream->Add("[%d] <- ", slot_index()); |
307 value()->PrintTo(stream); | 289 value()->PrintTo(stream); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 HBasicBlock* next = NULL; | 435 HBasicBlock* next = NULL; |
454 if (i < blocks->length() - 1) next = blocks->at(i + 1); | 436 if (i < blocks->length() - 1) next = blocks->at(i + 1); |
455 DoBasicBlock(blocks->at(i), next); | 437 DoBasicBlock(blocks->at(i), next); |
456 if (is_aborted()) return NULL; | 438 if (is_aborted()) return NULL; |
457 } | 439 } |
458 status_ = DONE; | 440 status_ = DONE; |
459 return chunk_; | 441 return chunk_; |
460 } | 442 } |
461 | 443 |
462 | 444 |
463 void LCodeGen::Abort(const char* reason) { | 445 void LCodeGen::Abort(BailoutReason reason) { |
464 info()->set_bailout_reason(reason); | 446 info()->set_bailout_reason(reason); |
465 status_ = ABORTED; | 447 status_ = ABORTED; |
466 } | 448 } |
467 | 449 |
468 | 450 |
469 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { | 451 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { |
470 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, | 452 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, |
471 Register::ToAllocationIndex(reg)); | 453 Register::ToAllocationIndex(reg)); |
472 } | 454 } |
473 | 455 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); | 643 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); |
662 return instr; | 644 return instr; |
663 } | 645 } |
664 | 646 |
665 | 647 |
666 LUnallocated* LChunkBuilder::TempRegister() { | 648 LUnallocated* LChunkBuilder::TempRegister() { |
667 LUnallocated* operand = | 649 LUnallocated* operand = |
668 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 650 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
669 int vreg = allocator_->GetVirtualRegister(); | 651 int vreg = allocator_->GetVirtualRegister(); |
670 if (!allocator_->AllocationOk()) { | 652 if (!allocator_->AllocationOk()) { |
671 Abort("Out of virtual registers while trying to allocate temp register."); | 653 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
672 vreg = 0; | 654 vreg = 0; |
673 } | 655 } |
674 operand->set_virtual_register(vreg); | 656 operand->set_virtual_register(vreg); |
675 return operand; | 657 return operand; |
676 } | 658 } |
677 | 659 |
678 | 660 |
679 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 661 LOperand* LChunkBuilder::FixedTemp(Register reg) { |
680 LUnallocated* operand = ToUnallocated(reg); | 662 LUnallocated* operand = ToUnallocated(reg); |
681 ASSERT(operand->HasFixedPolicy()); | 663 ASSERT(operand->HasFixedPolicy()); |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 | 1992 |
2011 | 1993 |
2012 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1994 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
2013 Representation r = instr->representation(); | 1995 Representation r = instr->representation(); |
2014 if (r.IsSmi()) { | 1996 if (r.IsSmi()) { |
2015 return DefineAsRegister(new(zone()) LConstantS); | 1997 return DefineAsRegister(new(zone()) LConstantS); |
2016 } else if (r.IsInteger32()) { | 1998 } else if (r.IsInteger32()) { |
2017 return DefineAsRegister(new(zone()) LConstantI); | 1999 return DefineAsRegister(new(zone()) LConstantI); |
2018 } else if (r.IsDouble()) { | 2000 } else if (r.IsDouble()) { |
2019 return DefineAsRegister(new(zone()) LConstantD); | 2001 return DefineAsRegister(new(zone()) LConstantD); |
| 2002 } else if (r.IsExternal()) { |
| 2003 return DefineAsRegister(new(zone()) LConstantE); |
2020 } else if (r.IsTagged()) { | 2004 } else if (r.IsTagged()) { |
2021 return DefineAsRegister(new(zone()) LConstantT); | 2005 return DefineAsRegister(new(zone()) LConstantT); |
2022 } else { | 2006 } else { |
2023 UNREACHABLE(); | 2007 UNREACHABLE(); |
2024 return NULL; | 2008 return NULL; |
2025 } | 2009 } |
2026 } | 2010 } |
2027 | 2011 |
2028 | 2012 |
2029 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { | 2013 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
(...skipping 23 matching lines...) Expand all Loading... |
2053 | 2037 |
2054 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | 2038 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { |
2055 LOperand* global_object = UseFixed(instr->global_object(), a1); | 2039 LOperand* global_object = UseFixed(instr->global_object(), a1); |
2056 LOperand* value = UseFixed(instr->value(), a0); | 2040 LOperand* value = UseFixed(instr->value(), a0); |
2057 LStoreGlobalGeneric* result = | 2041 LStoreGlobalGeneric* result = |
2058 new(zone()) LStoreGlobalGeneric(global_object, value); | 2042 new(zone()) LStoreGlobalGeneric(global_object, value); |
2059 return MarkAsCall(result, instr); | 2043 return MarkAsCall(result, instr); |
2060 } | 2044 } |
2061 | 2045 |
2062 | 2046 |
2063 LInstruction* LChunkBuilder::DoLinkObjectInList(HLinkObjectInList* instr) { | |
2064 LOperand* object = UseRegister(instr->value()); | |
2065 LLinkObjectInList* result = new(zone()) LLinkObjectInList(object); | |
2066 return result; | |
2067 } | |
2068 | |
2069 | |
2070 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 2047 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
2071 LOperand* context = UseRegisterAtStart(instr->value()); | 2048 LOperand* context = UseRegisterAtStart(instr->value()); |
2072 LInstruction* result = | 2049 LInstruction* result = |
2073 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 2050 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
2074 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2051 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
2075 } | 2052 } |
2076 | 2053 |
2077 | 2054 |
2078 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { | 2055 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { |
2079 LOperand* context; | 2056 LOperand* context; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2332 } | 2309 } |
2333 | 2310 |
2334 | 2311 |
2335 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2312 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
2336 LOperand* char_code = UseRegister(instr->value()); | 2313 LOperand* char_code = UseRegister(instr->value()); |
2337 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); | 2314 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); |
2338 return AssignPointerMap(DefineAsRegister(result)); | 2315 return AssignPointerMap(DefineAsRegister(result)); |
2339 } | 2316 } |
2340 | 2317 |
2341 | 2318 |
2342 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | |
2343 LOperand* string = UseRegisterAtStart(instr->value()); | |
2344 return DefineAsRegister(new(zone()) LStringLength(string)); | |
2345 } | |
2346 | |
2347 | |
2348 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { | 2319 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { |
2349 info()->MarkAsDeferredCalling(); | 2320 info()->MarkAsDeferredCalling(); |
2350 LOperand* size = instr->size()->IsConstant() | 2321 LOperand* size = instr->size()->IsConstant() |
2351 ? UseConstant(instr->size()) | 2322 ? UseConstant(instr->size()) |
2352 : UseTempRegister(instr->size()); | 2323 : UseTempRegister(instr->size()); |
2353 LOperand* temp1 = TempRegister(); | 2324 LOperand* temp1 = TempRegister(); |
2354 LOperand* temp2 = TempRegister(); | 2325 LOperand* temp2 = TempRegister(); |
2355 LAllocate* result = new(zone()) LAllocate(size, temp1, temp2); | 2326 LAllocate* result = new(zone()) LAllocate(size, temp1, temp2); |
2356 return AssignPointerMap(DefineAsRegister(result)); | 2327 return AssignPointerMap(DefineAsRegister(result)); |
2357 } | 2328 } |
(...skipping 29 matching lines...) Expand all Loading... |
2387 int index = static_cast<int>(instr->index()); | 2358 int index = static_cast<int>(instr->index()); |
2388 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); | 2359 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); |
2389 return DefineFixed(result, reg); | 2360 return DefineFixed(result, reg); |
2390 } | 2361 } |
2391 } | 2362 } |
2392 | 2363 |
2393 | 2364 |
2394 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2365 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
2395 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. | 2366 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. |
2396 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2367 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2397 Abort("Too many spill slots needed for OSR"); | 2368 Abort(kTooManySpillSlotsNeededForOSR); |
2398 spill_index = 0; | 2369 spill_index = 0; |
2399 } | 2370 } |
2400 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2371 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2401 } | 2372 } |
2402 | 2373 |
2403 | 2374 |
2404 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2375 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
2405 argument_count_ -= instr->argument_count(); | 2376 argument_count_ -= instr->argument_count(); |
2406 return MarkAsCall(DefineFixed(new(zone()) LCallStub, v0), instr); | 2377 return MarkAsCall(DefineFixed(new(zone()) LCallStub, v0), instr); |
2407 } | 2378 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2560 | 2531 |
2561 | 2532 |
2562 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2533 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2563 LOperand* object = UseRegister(instr->object()); | 2534 LOperand* object = UseRegister(instr->object()); |
2564 LOperand* index = UseRegister(instr->index()); | 2535 LOperand* index = UseRegister(instr->index()); |
2565 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2536 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2566 } | 2537 } |
2567 | 2538 |
2568 | 2539 |
2569 } } // namespace v8::internal | 2540 } } // namespace v8::internal |
OLD | NEW |