OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2448 __ movl(EDX, Immediate(num_context_variables())); | 2448 __ movl(EDX, Immediate(num_context_variables())); |
2449 StubCode* stub_code = compiler->isolate()->stub_code(); | 2449 StubCode* stub_code = compiler->isolate()->stub_code(); |
2450 const ExternalLabel label(stub_code->AllocateContextEntryPoint()); | 2450 const ExternalLabel label(stub_code->AllocateContextEntryPoint()); |
2451 compiler->GenerateCall(token_pos(), | 2451 compiler->GenerateCall(token_pos(), |
2452 &label, | 2452 &label, |
2453 RawPcDescriptors::kOther, | 2453 RawPcDescriptors::kOther, |
2454 locs()); | 2454 locs()); |
2455 } | 2455 } |
2456 | 2456 |
2457 | 2457 |
2458 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Isolate* isolate, | |
Florian Schneider
2014/08/15 09:56:35
I don't think we need a new instruction (and AST n
hausner
2014/08/15 23:00:46
On 2014/08/15 09:56:35, Florian Schneider wrote:
| |
2459 bool opt) const { | |
2460 const intptr_t kNumInputs = 1; | |
2461 const intptr_t kNumTemps = 1; | |
2462 LocationSummary* locs = new(isolate) LocationSummary( | |
2463 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | |
2464 locs->set_in(0, Location::RegisterLocation(EAX)); | |
2465 locs->set_out(0, Location::RegisterLocation(EAX)); | |
2466 locs->set_temp(0, Location::RegisterLocation(ECX)); | |
2467 return locs; | |
2468 } | |
2469 | |
2470 | |
2471 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
2472 Register field = locs()->in(0).reg(); | |
2473 Register result = locs()->out(0).reg(); | |
2474 Register temp = locs()->temp(0).reg(); | |
2475 | |
2476 Label call_runtime, no_call; | |
2477 | |
2478 __ movl(temp, FieldAddress(field, Field::value_offset())); | |
2479 __ CompareObject(temp, Object::sentinel()); | |
2480 __ j(EQUAL, &call_runtime); | |
2481 | |
2482 __ CompareObject(temp, Object::transition_sentinel()); | |
2483 __ j(NOT_EQUAL, &no_call); | |
2484 | |
2485 __ Bind(&call_runtime); | |
2486 __ PushObject(Object::null_object()); // Make room for (unused) result. | |
2487 __ pushl(field); | |
2488 compiler->GenerateRuntimeCall(token_pos(), | |
2489 deopt_id(), | |
2490 kInitStaticFieldRuntimeEntry, | |
2491 1, | |
2492 locs()); | |
2493 __ popl(result); // Remove argument. | |
2494 __ popl(result); // Remove result. | |
2495 | |
2496 __ Bind(&no_call); | |
2497 } | |
2498 | |
2499 | |
2500 | |
2458 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, | 2501 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, |
2459 bool opt) const { | 2502 bool opt) const { |
2460 const intptr_t kNumInputs = 1; | 2503 const intptr_t kNumInputs = 1; |
2461 const intptr_t kNumTemps = 0; | 2504 const intptr_t kNumTemps = 0; |
2462 LocationSummary* locs = new(isolate) LocationSummary( | 2505 LocationSummary* locs = new(isolate) LocationSummary( |
2463 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 2506 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
2464 locs->set_in(0, Location::RegisterLocation(EAX)); | 2507 locs->set_in(0, Location::RegisterLocation(EAX)); |
2465 locs->set_out(0, Location::RegisterLocation(EAX)); | 2508 locs->set_out(0, Location::RegisterLocation(EAX)); |
2466 return locs; | 2509 return locs; |
2467 } | 2510 } |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2800 if (op_kind() == Token::kSHL) { | 2843 if (op_kind() == Token::kSHL) { |
2801 EmitSmiShiftLeft(compiler, this); | 2844 EmitSmiShiftLeft(compiler, this); |
2802 return; | 2845 return; |
2803 } | 2846 } |
2804 | 2847 |
2805 Register left = locs()->in(0).reg(); | 2848 Register left = locs()->in(0).reg(); |
2806 Register result = locs()->out(0).reg(); | 2849 Register result = locs()->out(0).reg(); |
2807 ASSERT(left == result); | 2850 ASSERT(left == result); |
2808 Label* deopt = NULL; | 2851 Label* deopt = NULL; |
2809 if (CanDeoptimize()) { | 2852 if (CanDeoptimize()) { |
2810 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); | 2853 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); |
2811 } | 2854 } |
2812 | 2855 |
2813 if (locs()->in(1).IsConstant()) { | 2856 if (locs()->in(1).IsConstant()) { |
2814 const Object& constant = locs()->in(1).constant(); | 2857 const Object& constant = locs()->in(1).constant(); |
2815 ASSERT(constant.IsSmi()); | 2858 ASSERT(constant.IsSmi()); |
2816 const int32_t imm = reinterpret_cast<int32_t>(constant.raw()); | 2859 const int32_t imm = reinterpret_cast<int32_t>(constant.raw()); |
2817 switch (op_kind()) { | 2860 switch (op_kind()) { |
2818 case Token::kADD: | 2861 case Token::kADD: |
2819 if (imm != 0) { | 2862 if (imm != 0) { |
2820 // Checking overflow without emitting an instruction would be wrong. | 2863 // Checking overflow without emitting an instruction would be wrong. |
(...skipping 3707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6528 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6571 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
6529 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6572 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
6530 #endif | 6573 #endif |
6531 } | 6574 } |
6532 | 6575 |
6533 } // namespace dart | 6576 } // namespace dart |
6534 | 6577 |
6535 #undef __ | 6578 #undef __ |
6536 | 6579 |
6537 #endif // defined TARGET_ARCH_IA32 | 6580 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |