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

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

Issue 11415261: Revert 13117: "Enable stub generation using Hydrogen/Lithium (again)" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26 matching lines...) Expand all
37 namespace internal { 37 namespace internal {
38 38
39 #define DEFINE_COMPILE(type) \ 39 #define DEFINE_COMPILE(type) \
40 void L##type::CompileToNative(LCodeGen* generator) { \ 40 void L##type::CompileToNative(LCodeGen* generator) { \
41 generator->Do##type(this); \ 41 generator->Do##type(this); \
42 } 42 }
43 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) 43 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE)
44 #undef DEFINE_COMPILE 44 #undef DEFINE_COMPILE
45 45
46 LOsrEntry::LOsrEntry() { 46 LOsrEntry::LOsrEntry() {
47 for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) { 47 for (int i = 0; i < Register::kNumAllocatableRegisters; ++i) {
48 register_spills_[i] = NULL; 48 register_spills_[i] = NULL;
49 } 49 }
50 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); ++i) { 50 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; ++i) {
51 double_register_spills_[i] = NULL; 51 double_register_spills_[i] = NULL;
52 } 52 }
53 } 53 }
54 54
55 55
56 void LOsrEntry::MarkSpilledRegister(int allocation_index, 56 void LOsrEntry::MarkSpilledRegister(int allocation_index,
57 LOperand* spill_operand) { 57 LOperand* spill_operand) {
58 ASSERT(spill_operand->IsStackSlot()); 58 ASSERT(spill_operand->IsStackSlot());
59 ASSERT(register_spills_[allocation_index] == NULL); 59 ASSERT(register_spills_[allocation_index] == NULL);
60 register_spills_[allocation_index] = spill_operand; 60 register_spills_[allocation_index] = spill_operand;
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 453 }
454 454
455 455
456 LPlatformChunk* LChunkBuilder::Build() { 456 LPlatformChunk* LChunkBuilder::Build() {
457 ASSERT(is_unused()); 457 ASSERT(is_unused());
458 chunk_ = new(zone()) LPlatformChunk(info(), graph()); 458 chunk_ = new(zone()) LPlatformChunk(info(), graph());
459 HPhase phase("L_Building chunk", chunk_); 459 HPhase phase("L_Building chunk", chunk_);
460 status_ = BUILDING; 460 status_ = BUILDING;
461 461
462 // Reserve the first spill slot for the state of dynamic alignment. 462 // Reserve the first spill slot for the state of dynamic alignment.
463 if (info()->IsOptimizing()) { 463 int alignment_state_index = chunk_->GetNextSpillIndex(false);
464 int alignment_state_index = chunk_->GetNextSpillIndex(false); 464 ASSERT_EQ(alignment_state_index, 0);
465 ASSERT_EQ(alignment_state_index, 0); 465 USE(alignment_state_index);
466 USE(alignment_state_index);
467 }
468 466
469 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); 467 const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
470 for (int i = 0; i < blocks->length(); i++) { 468 for (int i = 0; i < blocks->length(); i++) {
471 HBasicBlock* next = NULL; 469 HBasicBlock* next = NULL;
472 if (i < blocks->length() - 1) next = blocks->at(i + 1); 470 if (i < blocks->length() - 1) next = blocks->at(i + 1);
473 DoBasicBlock(blocks->at(i), next); 471 DoBasicBlock(blocks->at(i), next);
474 if (is_aborted()) return NULL; 472 if (is_aborted()) return NULL;
475 } 473 }
476 status_ = DONE; 474 status_ = DONE;
477 return chunk_; 475 return chunk_;
(...skipping 11 matching lines...) Expand all
489 Register::ToAllocationIndex(reg)); 487 Register::ToAllocationIndex(reg));
490 } 488 }
491 489
492 490
493 LUnallocated* LChunkBuilder::ToUnallocated(XMMRegister reg) { 491 LUnallocated* LChunkBuilder::ToUnallocated(XMMRegister reg) {
494 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER, 492 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER,
495 XMMRegister::ToAllocationIndex(reg)); 493 XMMRegister::ToAllocationIndex(reg));
496 } 494 }
497 495
498 496
499 LUnallocated* LChunkBuilder::ToUnallocated(X87TopOfStackRegister reg) {
500 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER,
501 X87TopOfStackRegister::ToAllocationIndex(reg));
502 }
503
504
505 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { 497 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) {
506 return Use(value, ToUnallocated(fixed_register)); 498 return Use(value, ToUnallocated(fixed_register));
507 } 499 }
508 500
509 501
510 LOperand* LChunkBuilder::UseFixedDouble(HValue* value, XMMRegister reg) { 502 LOperand* LChunkBuilder::UseFixedDouble(HValue* value, XMMRegister reg) {
511 return Use(value, ToUnallocated(reg)); 503 return Use(value, ToUnallocated(reg));
512 } 504 }
513 505
514 506
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 619
628 620
629 template<int I, int T> 621 template<int I, int T>
630 LInstruction* LChunkBuilder::DefineFixedDouble( 622 LInstruction* LChunkBuilder::DefineFixedDouble(
631 LTemplateInstruction<1, I, T>* instr, 623 LTemplateInstruction<1, I, T>* instr,
632 XMMRegister reg) { 624 XMMRegister reg) {
633 return Define(instr, ToUnallocated(reg)); 625 return Define(instr, ToUnallocated(reg));
634 } 626 }
635 627
636 628
637 template<int I, int T>
638 LInstruction* LChunkBuilder::DefineX87TOS(
639 LTemplateInstruction<1, I, T>* instr) {
640 return Define(instr, ToUnallocated(x87tos));
641 }
642
643
644 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { 629 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
645 HEnvironment* hydrogen_env = current_block_->last_environment(); 630 HEnvironment* hydrogen_env = current_block_->last_environment();
646 int argument_index_accumulator = 0; 631 int argument_index_accumulator = 0;
647 instr->set_environment(CreateEnvironment(hydrogen_env, 632 instr->set_environment(CreateEnvironment(hydrogen_env,
648 &argument_index_accumulator)); 633 &argument_index_accumulator));
649 return instr; 634 return instr;
650 } 635 }
651 636
652 637
653 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, 638 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
654 HInstruction* hinstr, 639 HInstruction* hinstr,
655 CanDeoptimize can_deoptimize) { 640 CanDeoptimize can_deoptimize) {
656 info()->MarkAsNonDeferredCalling();
657
658 #ifdef DEBUG 641 #ifdef DEBUG
659 instr->VerifyCall(); 642 instr->VerifyCall();
660 #endif 643 #endif
661 instr->MarkAsCall(); 644 instr->MarkAsCall();
662 instr = AssignPointerMap(instr); 645 instr = AssignPointerMap(instr);
663 646
664 if (hinstr->HasObservableSideEffects()) { 647 if (hinstr->HasObservableSideEffects()) {
665 ASSERT(hinstr->next()->IsSimulate()); 648 ASSERT(hinstr->next()->IsSimulate());
666 HSimulate* sim = HSimulate::cast(hinstr->next()); 649 HSimulate* sim = HSimulate::cast(hinstr->next());
667 ASSERT(instruction_pending_deoptimization_environment_ == NULL); 650 ASSERT(instruction_pending_deoptimization_environment_ == NULL);
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 // All HForceRepresentation instructions should be eliminated in the 1673 // All HForceRepresentation instructions should be eliminated in the
1691 // representation change phase of Hydrogen. 1674 // representation change phase of Hydrogen.
1692 UNREACHABLE(); 1675 UNREACHABLE();
1693 return NULL; 1676 return NULL;
1694 } 1677 }
1695 1678
1696 1679
1697 LInstruction* LChunkBuilder::DoChange(HChange* instr) { 1680 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1698 Representation from = instr->from(); 1681 Representation from = instr->from();
1699 Representation to = instr->to(); 1682 Representation to = instr->to();
1700 // Only mark conversions that might need to allocate as calling rather than
1701 // all changes. This makes simple, non-allocating conversion not have to force
1702 // building a stack frame.
1703 if (from.IsTagged()) { 1683 if (from.IsTagged()) {
1704 if (to.IsDouble()) { 1684 if (to.IsDouble()) {
1705 info()->MarkAsDeferredCalling();
1706 LOperand* value = UseRegister(instr->value()); 1685 LOperand* value = UseRegister(instr->value());
1707 // Temp register only necessary for minus zero check. 1686 // Temp register only necessary for minus zero check.
1708 LOperand* temp = instr->deoptimize_on_minus_zero() 1687 LOperand* temp = instr->deoptimize_on_minus_zero()
1709 ? TempRegister() 1688 ? TempRegister()
1710 : NULL; 1689 : NULL;
1711 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); 1690 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp);
1712 return AssignEnvironment(DefineAsRegister(res)); 1691 return AssignEnvironment(DefineAsRegister(res));
1713 } else { 1692 } else {
1714 ASSERT(to.IsInteger32()); 1693 ASSERT(to.IsInteger32());
1715 LOperand* value = UseRegister(instr->value()); 1694 LOperand* value = UseRegister(instr->value());
1716 if (instr->value()->type().IsSmi()) { 1695 if (instr->value()->type().IsSmi()) {
1717 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); 1696 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
1718 } else { 1697 } else {
1719 bool truncating = instr->CanTruncateToInt32(); 1698 bool truncating = instr->CanTruncateToInt32();
1720 LOperand* xmm_temp = 1699 LOperand* xmm_temp =
1721 (truncating && CpuFeatures::IsSupported(SSE3)) 1700 (truncating && CpuFeatures::IsSupported(SSE3))
1722 ? NULL 1701 ? NULL
1723 : FixedTemp(xmm1); 1702 : FixedTemp(xmm1);
1724 LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp); 1703 LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp);
1725 return AssignEnvironment(DefineSameAsFirst(res)); 1704 return AssignEnvironment(DefineSameAsFirst(res));
1726 } 1705 }
1727 } 1706 }
1728 } else if (from.IsDouble()) { 1707 } else if (from.IsDouble()) {
1729 if (to.IsTagged()) { 1708 if (to.IsTagged()) {
1730 info()->MarkAsDeferredCalling(); 1709 LOperand* value = UseRegister(instr->value());
1731 LOperand* value = CpuFeatures::IsSupported(SSE2)
1732 ? UseRegisterAtStart(instr->value())
1733 : UseAtStart(instr->value());
1734 LOperand* temp = TempRegister(); 1710 LOperand* temp = TempRegister();
1735 1711
1736 // Make sure that temp and result_temp are different registers. 1712 // Make sure that temp and result_temp are different registers.
1737 LUnallocated* result_temp = TempRegister(); 1713 LUnallocated* result_temp = TempRegister();
1738 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); 1714 LNumberTagD* result = new(zone()) LNumberTagD(value, temp);
1739 return AssignPointerMap(Define(result, result_temp)); 1715 return AssignPointerMap(Define(result, result_temp));
1740 } else { 1716 } else {
1741 ASSERT(to.IsInteger32()); 1717 ASSERT(to.IsInteger32());
1742 bool truncating = instr->CanTruncateToInt32(); 1718 bool truncating = instr->CanTruncateToInt32();
1743 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3); 1719 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3);
1744 LOperand* value = needs_temp ? 1720 LOperand* value = needs_temp ?
1745 UseTempRegister(instr->value()) : UseRegister(instr->value()); 1721 UseTempRegister(instr->value()) : UseRegister(instr->value());
1746 LOperand* temp = needs_temp ? TempRegister() : NULL; 1722 LOperand* temp = needs_temp ? TempRegister() : NULL;
1747 return AssignEnvironment( 1723 return AssignEnvironment(
1748 DefineAsRegister(new(zone()) LDoubleToI(value, temp))); 1724 DefineAsRegister(new(zone()) LDoubleToI(value, temp)));
1749 } 1725 }
1750 } else if (from.IsInteger32()) { 1726 } else if (from.IsInteger32()) {
1751 info()->MarkAsDeferredCalling();
1752 if (to.IsTagged()) { 1727 if (to.IsTagged()) {
1753 HValue* val = instr->value(); 1728 HValue* val = instr->value();
1754 LOperand* value = UseRegister(val); 1729 LOperand* value = UseRegister(val);
1755 if (val->HasRange() && val->range()->IsInSmiRange()) { 1730 if (val->HasRange() && val->range()->IsInSmiRange()) {
1756 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1731 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1757 } else if (val->CheckFlag(HInstruction::kUint32)) { 1732 } else if (val->CheckFlag(HInstruction::kUint32)) {
1758 LOperand* temp = FixedTemp(xmm1); 1733 LOperand* temp = FixedTemp(xmm1);
1759 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); 1734 LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
1760 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1735 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1761 } else { 1736 } else {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 2233
2259 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { 2234 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2260 ASSERT(argument_count_ == 0); 2235 ASSERT(argument_count_ == 0);
2261 allocator_->MarkAsOsrEntry(); 2236 allocator_->MarkAsOsrEntry();
2262 current_block_->last_environment()->set_ast_id(instr->ast_id()); 2237 current_block_->last_environment()->set_ast_id(instr->ast_id());
2263 return AssignEnvironment(new(zone()) LOsrEntry); 2238 return AssignEnvironment(new(zone()) LOsrEntry);
2264 } 2239 }
2265 2240
2266 2241
2267 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { 2242 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2268 LParameter* result = new(zone()) LParameter; 2243 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2269 if (info()->IsOptimizing()) { 2244 return DefineAsSpilled(new(zone()) LParameter, spill_index);
2270 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2271 return DefineAsSpilled(result, spill_index);
2272 } else {
2273 ASSERT(info()->IsStub());
2274 CodeStubInterfaceDescriptor* descriptor =
2275 info()->code_stub()->GetInterfaceDescriptor(info()->isolate());
2276 Register reg = descriptor->register_params[instr->index()];
2277 return DefineFixed(result, reg);
2278 }
2279 } 2245 }
2280 2246
2281 2247
2282 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { 2248 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2283 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. 2249 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
2284 if (spill_index > LUnallocated::kMaxFixedIndex) { 2250 if (spill_index > LUnallocated::kMaxFixedIndex) {
2285 Abort("Too many spill slots needed for OSR"); 2251 Abort("Too many spill slots needed for OSR");
2286 spill_index = 0; 2252 spill_index = 0;
2287 } 2253 }
2288 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); 2254 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 instruction_pending_deoptimization_environment_ = NULL; 2335 instruction_pending_deoptimization_environment_ = NULL;
2370 pending_deoptimization_ast_id_ = BailoutId::None(); 2336 pending_deoptimization_ast_id_ = BailoutId::None();
2371 return result; 2337 return result;
2372 } 2338 }
2373 2339
2374 return NULL; 2340 return NULL;
2375 } 2341 }
2376 2342
2377 2343
2378 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2344 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2379 info()->MarkAsDeferredCalling();
2380 if (instr->is_function_entry()) { 2345 if (instr->is_function_entry()) {
2381 LOperand* context = UseFixed(instr->context(), esi); 2346 LOperand* context = UseFixed(instr->context(), esi);
2382 return MarkAsCall(new(zone()) LStackCheck(context), instr); 2347 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2383 } else { 2348 } else {
2384 ASSERT(instr->is_backwards_branch()); 2349 ASSERT(instr->is_backwards_branch());
2385 LOperand* context = UseAny(instr->context()); 2350 LOperand* context = UseAny(instr->context());
2386 return AssignEnvironment( 2351 return AssignEnvironment(
2387 AssignPointerMap(new(zone()) LStackCheck(context))); 2352 AssignPointerMap(new(zone()) LStackCheck(context)));
2388 } 2353 }
2389 } 2354 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2460 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2425 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2461 LOperand* object = UseRegister(instr->object()); 2426 LOperand* object = UseRegister(instr->object());
2462 LOperand* index = UseTempRegister(instr->index()); 2427 LOperand* index = UseTempRegister(instr->index());
2463 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2428 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2464 } 2429 }
2465 2430
2466 2431
2467 } } // namespace v8::internal 2432 } } // namespace v8::internal
2468 2433
2469 #endif // V8_TARGET_ARCH_IA32 2434 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698