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

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

Issue 11498006: Revert 13157, 13145 and 13140: Crankshaft code stubs. (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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 // All HForceRepresentation instructions should be eliminated in the 1684 // All HForceRepresentation instructions should be eliminated in the
1702 // representation change phase of Hydrogen. 1685 // representation change phase of Hydrogen.
1703 UNREACHABLE(); 1686 UNREACHABLE();
1704 return NULL; 1687 return NULL;
1705 } 1688 }
1706 1689
1707 1690
1708 LInstruction* LChunkBuilder::DoChange(HChange* instr) { 1691 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1709 Representation from = instr->from(); 1692 Representation from = instr->from();
1710 Representation to = instr->to(); 1693 Representation to = instr->to();
1711 // Only mark conversions that might need to allocate as calling rather than
1712 // all changes. This makes simple, non-allocating conversion not have to force
1713 // building a stack frame.
1714 if (from.IsTagged()) { 1694 if (from.IsTagged()) {
1715 if (to.IsDouble()) { 1695 if (to.IsDouble()) {
1716 info()->MarkAsDeferredCalling();
1717 LOperand* value = UseRegister(instr->value()); 1696 LOperand* value = UseRegister(instr->value());
1718 // Temp register only necessary for minus zero check. 1697 // Temp register only necessary for minus zero check.
1719 LOperand* temp = instr->deoptimize_on_minus_zero() 1698 LOperand* temp = instr->deoptimize_on_minus_zero()
1720 ? TempRegister() 1699 ? TempRegister()
1721 : NULL; 1700 : NULL;
1722 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); 1701 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp);
1723 return AssignEnvironment(DefineAsRegister(res)); 1702 return AssignEnvironment(DefineAsRegister(res));
1724 } else { 1703 } else {
1725 ASSERT(to.IsInteger32()); 1704 ASSERT(to.IsInteger32());
1726 LOperand* value = UseRegister(instr->value()); 1705 LOperand* value = UseRegister(instr->value());
1727 if (instr->value()->type().IsSmi()) { 1706 if (instr->value()->type().IsSmi()) {
1728 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); 1707 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
1729 } else { 1708 } else {
1730 bool truncating = instr->CanTruncateToInt32(); 1709 bool truncating = instr->CanTruncateToInt32();
1731 LOperand* xmm_temp = 1710 LOperand* xmm_temp =
1732 (truncating && CpuFeatures::IsSupported(SSE3)) 1711 (truncating && CpuFeatures::IsSupported(SSE3))
1733 ? NULL 1712 ? NULL
1734 : FixedTemp(xmm1); 1713 : FixedTemp(xmm1);
1735 LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp); 1714 LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp);
1736 return AssignEnvironment(DefineSameAsFirst(res)); 1715 return AssignEnvironment(DefineSameAsFirst(res));
1737 } 1716 }
1738 } 1717 }
1739 } else if (from.IsDouble()) { 1718 } else if (from.IsDouble()) {
1740 if (to.IsTagged()) { 1719 if (to.IsTagged()) {
1741 info()->MarkAsDeferredCalling(); 1720 LOperand* value = UseRegister(instr->value());
1742 LOperand* value = CpuFeatures::IsSupported(SSE2)
1743 ? UseRegisterAtStart(instr->value())
1744 : UseAtStart(instr->value());
1745 LOperand* temp = TempRegister(); 1721 LOperand* temp = TempRegister();
1746 1722
1747 // Make sure that temp and result_temp are different registers. 1723 // Make sure that temp and result_temp are different registers.
1748 LUnallocated* result_temp = TempRegister(); 1724 LUnallocated* result_temp = TempRegister();
1749 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); 1725 LNumberTagD* result = new(zone()) LNumberTagD(value, temp);
1750 return AssignPointerMap(Define(result, result_temp)); 1726 return AssignPointerMap(Define(result, result_temp));
1751 } else { 1727 } else {
1752 ASSERT(to.IsInteger32()); 1728 ASSERT(to.IsInteger32());
1753 bool truncating = instr->CanTruncateToInt32(); 1729 bool truncating = instr->CanTruncateToInt32();
1754 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3); 1730 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3);
1755 LOperand* value = needs_temp ? 1731 LOperand* value = needs_temp ?
1756 UseTempRegister(instr->value()) : UseRegister(instr->value()); 1732 UseTempRegister(instr->value()) : UseRegister(instr->value());
1757 LOperand* temp = needs_temp ? TempRegister() : NULL; 1733 LOperand* temp = needs_temp ? TempRegister() : NULL;
1758 return AssignEnvironment( 1734 return AssignEnvironment(
1759 DefineAsRegister(new(zone()) LDoubleToI(value, temp))); 1735 DefineAsRegister(new(zone()) LDoubleToI(value, temp)));
1760 } 1736 }
1761 } else if (from.IsInteger32()) { 1737 } else if (from.IsInteger32()) {
1762 info()->MarkAsDeferredCalling();
1763 if (to.IsTagged()) { 1738 if (to.IsTagged()) {
1764 HValue* val = instr->value(); 1739 HValue* val = instr->value();
1765 LOperand* value = UseRegister(val); 1740 LOperand* value = UseRegister(val);
1766 if (val->HasRange() && val->range()->IsInSmiRange()) { 1741 if (val->HasRange() && val->range()->IsInSmiRange()) {
1767 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1742 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1768 } else if (val->CheckFlag(HInstruction::kUint32)) { 1743 } else if (val->CheckFlag(HInstruction::kUint32)) {
1769 LOperand* temp = FixedTemp(xmm1); 1744 LOperand* temp = FixedTemp(xmm1);
1770 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); 1745 LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
1771 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1746 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1772 } else { 1747 } else {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 2244
2270 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { 2245 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2271 ASSERT(argument_count_ == 0); 2246 ASSERT(argument_count_ == 0);
2272 allocator_->MarkAsOsrEntry(); 2247 allocator_->MarkAsOsrEntry();
2273 current_block_->last_environment()->set_ast_id(instr->ast_id()); 2248 current_block_->last_environment()->set_ast_id(instr->ast_id());
2274 return AssignEnvironment(new(zone()) LOsrEntry); 2249 return AssignEnvironment(new(zone()) LOsrEntry);
2275 } 2250 }
2276 2251
2277 2252
2278 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { 2253 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2279 LParameter* result = new(zone()) LParameter; 2254 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2280 if (info()->IsOptimizing()) { 2255 return DefineAsSpilled(new(zone()) LParameter, spill_index);
2281 int spill_index = chunk()->GetParameterStackSlot(instr->index());
2282 return DefineAsSpilled(result, spill_index);
2283 } else {
2284 ASSERT(info()->IsStub());
2285 CodeStubInterfaceDescriptor* descriptor =
2286 info()->code_stub()->GetInterfaceDescriptor(info()->isolate());
2287 Register reg = descriptor->register_params_[instr->index()];
2288 return DefineFixed(result, reg);
2289 }
2290 } 2256 }
2291 2257
2292 2258
2293 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { 2259 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2294 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. 2260 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
2295 if (spill_index > LUnallocated::kMaxFixedIndex) { 2261 if (spill_index > LUnallocated::kMaxFixedIndex) {
2296 Abort("Too many spill slots needed for OSR"); 2262 Abort("Too many spill slots needed for OSR");
2297 spill_index = 0; 2263 spill_index = 0;
2298 } 2264 }
2299 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); 2265 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 instruction_pending_deoptimization_environment_ = NULL; 2346 instruction_pending_deoptimization_environment_ = NULL;
2381 pending_deoptimization_ast_id_ = BailoutId::None(); 2347 pending_deoptimization_ast_id_ = BailoutId::None();
2382 return result; 2348 return result;
2383 } 2349 }
2384 2350
2385 return NULL; 2351 return NULL;
2386 } 2352 }
2387 2353
2388 2354
2389 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2355 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2390 info()->MarkAsDeferredCalling();
2391 if (instr->is_function_entry()) { 2356 if (instr->is_function_entry()) {
2392 LOperand* context = UseFixed(instr->context(), esi); 2357 LOperand* context = UseFixed(instr->context(), esi);
2393 return MarkAsCall(new(zone()) LStackCheck(context), instr); 2358 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2394 } else { 2359 } else {
2395 ASSERT(instr->is_backwards_branch()); 2360 ASSERT(instr->is_backwards_branch());
2396 LOperand* context = UseAny(instr->context()); 2361 LOperand* context = UseAny(instr->context());
2397 return AssignEnvironment( 2362 return AssignEnvironment(
2398 AssignPointerMap(new(zone()) LStackCheck(context))); 2363 AssignPointerMap(new(zone()) LStackCheck(context)));
2399 } 2364 }
2400 } 2365 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2436 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2472 LOperand* object = UseRegister(instr->object()); 2437 LOperand* object = UseRegister(instr->object());
2473 LOperand* index = UseTempRegister(instr->index()); 2438 LOperand* index = UseTempRegister(instr->index());
2474 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2439 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2475 } 2440 }
2476 2441
2477 2442
2478 } } // namespace v8::internal 2443 } } // namespace v8::internal
2479 2444
2480 #endif // V8_TARGET_ARCH_IA32 2445 #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