| 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 12 matching lines...) Expand all  Loading... | 
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| 27 | 27 | 
| 28 #include "v8.h" | 28 #include "v8.h" | 
| 29 | 29 | 
| 30 #include "lithium-allocator-inl.h" | 30 #include "lithium-allocator-inl.h" | 
| 31 #include "mips/lithium-mips.h" | 31 #include "mips/lithium-mips.h" | 
| 32 #include "mips/lithium-codegen-mips.h" | 32 #include "mips/lithium-codegen-mips.h" | 
|  | 33 #include "hydrogen-osr.h" | 
| 33 | 34 | 
| 34 namespace v8 { | 35 namespace v8 { | 
| 35 namespace internal { | 36 namespace internal { | 
| 36 | 37 | 
| 37 #define DEFINE_COMPILE(type)                            \ | 38 #define DEFINE_COMPILE(type)                            \ | 
| 38   void L##type::CompileToNative(LCodeGen* generator) {  \ | 39   void L##type::CompileToNative(LCodeGen* generator) {  \ | 
| 39     generator->Do##type(this);                          \ | 40     generator->Do##type(this);                          \ | 
| 40   } | 41   } | 
| 41 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) | 42 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) | 
| 42 #undef DEFINE_COMPILE | 43 #undef DEFINE_COMPILE | 
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 441     return LStackSlot::Create(index, zone()); | 442     return LStackSlot::Create(index, zone()); | 
| 442   } | 443   } | 
| 443 } | 444 } | 
| 444 | 445 | 
| 445 | 446 | 
| 446 LPlatformChunk* LChunkBuilder::Build() { | 447 LPlatformChunk* LChunkBuilder::Build() { | 
| 447   ASSERT(is_unused()); | 448   ASSERT(is_unused()); | 
| 448   chunk_ = new(zone()) LPlatformChunk(info(), graph()); | 449   chunk_ = new(zone()) LPlatformChunk(info(), graph()); | 
| 449   LPhase phase("L_Building chunk", chunk_); | 450   LPhase phase("L_Building chunk", chunk_); | 
| 450   status_ = BUILDING; | 451   status_ = BUILDING; | 
|  | 452 | 
|  | 453   // If compiling for OSR, reserve space for the unoptimized frame, | 
|  | 454   // which will be subsumed into this frame. | 
|  | 455   if (graph()->has_osr()) { | 
|  | 456     for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { | 
|  | 457       chunk_->GetNextSpillIndex(false); | 
|  | 458     } | 
|  | 459   } | 
|  | 460 | 
| 451   const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); | 461   const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); | 
| 452   for (int i = 0; i < blocks->length(); i++) { | 462   for (int i = 0; i < blocks->length(); i++) { | 
| 453     HBasicBlock* next = NULL; | 463     HBasicBlock* next = NULL; | 
| 454     if (i < blocks->length() - 1) next = blocks->at(i + 1); | 464     if (i < blocks->length() - 1) next = blocks->at(i + 1); | 
| 455     DoBasicBlock(blocks->at(i), next); | 465     DoBasicBlock(blocks->at(i), next); | 
| 456     if (is_aborted()) return NULL; | 466     if (is_aborted()) return NULL; | 
| 457   } | 467   } | 
| 458   status_ = DONE; | 468   status_ = DONE; | 
| 459   return chunk_; | 469   return chunk_; | 
| 460 } | 470 } | 
| (...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2387     CodeStubInterfaceDescriptor* descriptor = | 2397     CodeStubInterfaceDescriptor* descriptor = | 
| 2388         info()->code_stub()->GetInterfaceDescriptor(info()->isolate()); | 2398         info()->code_stub()->GetInterfaceDescriptor(info()->isolate()); | 
| 2389     int index = static_cast<int>(instr->index()); | 2399     int index = static_cast<int>(instr->index()); | 
| 2390     Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); | 2400     Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); | 
| 2391     return DefineFixed(result, reg); | 2401     return DefineFixed(result, reg); | 
| 2392   } | 2402   } | 
| 2393 } | 2403 } | 
| 2394 | 2404 | 
| 2395 | 2405 | 
| 2396 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2406 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 
| 2397   int spill_index = chunk()->GetNextSpillIndex(false);  // Not double-width. | 2407   // Use an index that corresponds to the location in the unoptimized frame, | 
| 2398   if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2408   // which the optimized frame will subsume. | 
| 2399     Abort("Too many spill slots needed for OSR"); | 2409   int env_index = instr->index(); | 
| 2400     spill_index = 0; | 2410   int spill_index = 0; | 
|  | 2411   if (instr->environment()->is_parameter_index(env_index)) { | 
|  | 2412     spill_index = chunk()->GetParameterStackSlot(env_index); | 
|  | 2413   } else { | 
|  | 2414     spill_index = env_index - instr->environment()->first_local_index(); | 
|  | 2415     if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 
|  | 2416       Abort("Too many spill slots needed for OSR"); | 
|  | 2417       spill_index = 0; | 
|  | 2418     } | 
| 2401   } | 2419   } | 
| 2402   return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2420   return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 
| 2403 } | 2421 } | 
| 2404 | 2422 | 
| 2405 | 2423 | 
| 2406 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2424 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 
| 2407   argument_count_ -= instr->argument_count(); | 2425   argument_count_ -= instr->argument_count(); | 
| 2408   return MarkAsCall(DefineFixed(new(zone()) LCallStub, v0), instr); | 2426   return MarkAsCall(DefineFixed(new(zone()) LCallStub, v0), instr); | 
| 2409 } | 2427 } | 
| 2410 | 2428 | 
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2562 | 2580 | 
| 2563 | 2581 | 
| 2564 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2582 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 
| 2565   LOperand* object = UseRegister(instr->object()); | 2583   LOperand* object = UseRegister(instr->object()); | 
| 2566   LOperand* index = UseRegister(instr->index()); | 2584   LOperand* index = UseRegister(instr->index()); | 
| 2567   return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2585   return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 
| 2568 } | 2586 } | 
| 2569 | 2587 | 
| 2570 | 2588 | 
| 2571 } }  // namespace v8::internal | 2589 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|