Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: src/x64/lithium-x64.cc

Issue 21340002: Generate a custom OSR entrypoint for OSR compiles on all platforms, and transition to optimized cod… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 14 matching lines...) Expand all
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 #if V8_TARGET_ARCH_X64 30 #if V8_TARGET_ARCH_X64
31 31
32 #include "lithium-allocator-inl.h" 32 #include "lithium-allocator-inl.h"
33 #include "x64/lithium-x64.h" 33 #include "x64/lithium-x64.h"
34 #include "x64/lithium-codegen-x64.h" 34 #include "x64/lithium-codegen-x64.h"
35 #include "hydrogen-osr.h"
35 36
36 namespace v8 { 37 namespace v8 {
37 namespace internal { 38 namespace internal {
38 39
39 #define DEFINE_COMPILE(type) \ 40 #define DEFINE_COMPILE(type) \
40 void L##type::CompileToNative(LCodeGen* generator) { \ 41 void L##type::CompileToNative(LCodeGen* generator) { \
41 generator->Do##type(this); \ 42 generator->Do##type(this); \
42 } 43 }
43 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) 44 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE)
44 #undef DEFINE_COMPILE 45 #undef DEFINE_COMPILE
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 object()->PrintTo(stream); 443 object()->PrintTo(stream);
443 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); 444 stream->Add(" %p -> %p", *original_map(), *transitioned_map());
444 } 445 }
445 446
446 447
447 LPlatformChunk* LChunkBuilder::Build() { 448 LPlatformChunk* LChunkBuilder::Build() {
448 ASSERT(is_unused()); 449 ASSERT(is_unused());
449 chunk_ = new(zone()) LPlatformChunk(info(), graph()); 450 chunk_ = new(zone()) LPlatformChunk(info(), graph());
450 LPhase phase("L_Building chunk", chunk_); 451 LPhase phase("L_Building chunk", chunk_);
451 status_ = BUILDING; 452 status_ = BUILDING;
453
454 // If compiling for OSR, reserve space for the unoptimized frame,
455 // which will be subsumed into this frame.
456 if (graph()->has_osr()) {
457 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) {
458 chunk_->GetNextSpillIndex(false);
459 }
460 }
461
452 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); 462 const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
453 for (int i = 0; i < blocks->length(); i++) { 463 for (int i = 0; i < blocks->length(); i++) {
454 HBasicBlock* next = NULL; 464 HBasicBlock* next = NULL;
455 if (i < blocks->length() - 1) next = blocks->at(i + 1); 465 if (i < blocks->length() - 1) next = blocks->at(i + 1);
456 DoBasicBlock(blocks->at(i), next); 466 DoBasicBlock(blocks->at(i), next);
457 if (is_aborted()) return NULL; 467 if (is_aborted()) return NULL;
458 } 468 }
459 status_ = DONE; 469 status_ = DONE;
460 return chunk_; 470 return chunk_;
461 } 471 }
(...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 CodeStubInterfaceDescriptor* descriptor = 2400 CodeStubInterfaceDescriptor* descriptor =
2391 info()->code_stub()->GetInterfaceDescriptor(info()->isolate()); 2401 info()->code_stub()->GetInterfaceDescriptor(info()->isolate());
2392 int index = static_cast<int>(instr->index()); 2402 int index = static_cast<int>(instr->index());
2393 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); 2403 Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index);
2394 return DefineFixed(result, reg); 2404 return DefineFixed(result, reg);
2395 } 2405 }
2396 } 2406 }
2397 2407
2398 2408
2399 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { 2409 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2400 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. 2410 // Use an index that corresponds to the location in the unoptimized frame,
2401 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { 2411 // which the optimized frame will subsume.
2402 Abort("Too many spill slots needed for OSR"); 2412 int env_index = instr->index();
2403 spill_index = 0; 2413 int spill_index = 0;
2414 if (instr->environment()->is_parameter_index(env_index)) {
2415 spill_index = chunk()->GetParameterStackSlot(env_index);
2416 } else {
2417 spill_index = env_index - instr->environment()->first_local_index();
2418 if (spill_index > LUnallocated::kMaxFixedSlotIndex) {
2419 Abort("Too many spill slots needed for OSR");
2420 spill_index = 0;
2421 }
2404 } 2422 }
2405 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); 2423 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
2406 } 2424 }
2407 2425
2408 2426
2409 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { 2427 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2410 argument_count_ -= instr->argument_count(); 2428 argument_count_ -= instr->argument_count();
2411 return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr); 2429 return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr);
2412 } 2430 }
2413 2431
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2587 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2570 LOperand* object = UseRegister(instr->object()); 2588 LOperand* object = UseRegister(instr->object());
2571 LOperand* index = UseTempRegister(instr->index()); 2589 LOperand* index = UseTempRegister(instr->index());
2572 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2590 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2573 } 2591 }
2574 2592
2575 2593
2576 } } // namespace v8::internal 2594 } } // namespace v8::internal
2577 2595
2578 #endif // V8_TARGET_ARCH_X64 2596 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698