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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 471283002: Runtime support for evaluation of static field initializer expressions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('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 (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
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,
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_temp(0, Location::RegisterLocation(ECX));
2466 return locs;
2467 }
2468
2469
2470 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2471 Register field = locs()->in(0).reg();
2472 Register temp = locs()->temp(0).reg();
2473
2474 Label call_runtime, no_call;
2475
2476 __ movl(temp, FieldAddress(field, Field::value_offset()));
2477 __ CompareObject(temp, Object::sentinel());
2478 __ j(EQUAL, &call_runtime);
2479
2480 __ CompareObject(temp, Object::transition_sentinel());
2481 __ j(NOT_EQUAL, &no_call);
2482
2483 __ Bind(&call_runtime);
2484 __ PushObject(Object::null_object()); // Make room for (unused) result.
2485 __ pushl(field);
2486 compiler->GenerateRuntimeCall(token_pos(),
2487 deopt_id(),
2488 kInitStaticFieldRuntimeEntry,
2489 1,
2490 locs());
2491 __ Drop(2); // Remove argument and unused result.
2492 __ Bind(&no_call);
2493 }
2494
2495
2458 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate, 2496 LocationSummary* CloneContextInstr::MakeLocationSummary(Isolate* isolate,
2459 bool opt) const { 2497 bool opt) const {
2460 const intptr_t kNumInputs = 1; 2498 const intptr_t kNumInputs = 1;
2461 const intptr_t kNumTemps = 0; 2499 const intptr_t kNumTemps = 0;
2462 LocationSummary* locs = new(isolate) LocationSummary( 2500 LocationSummary* locs = new(isolate) LocationSummary(
2463 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 2501 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
2464 locs->set_in(0, Location::RegisterLocation(EAX)); 2502 locs->set_in(0, Location::RegisterLocation(EAX));
2465 locs->set_out(0, Location::RegisterLocation(EAX)); 2503 locs->set_out(0, Location::RegisterLocation(EAX));
2466 return locs; 2504 return locs;
2467 } 2505 }
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 if (op_kind() == Token::kSHL) { 2838 if (op_kind() == Token::kSHL) {
2801 EmitSmiShiftLeft(compiler, this); 2839 EmitSmiShiftLeft(compiler, this);
2802 return; 2840 return;
2803 } 2841 }
2804 2842
2805 Register left = locs()->in(0).reg(); 2843 Register left = locs()->in(0).reg();
2806 Register result = locs()->out(0).reg(); 2844 Register result = locs()->out(0).reg();
2807 ASSERT(left == result); 2845 ASSERT(left == result);
2808 Label* deopt = NULL; 2846 Label* deopt = NULL;
2809 if (CanDeoptimize()) { 2847 if (CanDeoptimize()) {
2810 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); 2848 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
2811 } 2849 }
2812 2850
2813 if (locs()->in(1).IsConstant()) { 2851 if (locs()->in(1).IsConstant()) {
2814 const Object& constant = locs()->in(1).constant(); 2852 const Object& constant = locs()->in(1).constant();
2815 ASSERT(constant.IsSmi()); 2853 ASSERT(constant.IsSmi());
2816 const int32_t imm = reinterpret_cast<int32_t>(constant.raw()); 2854 const int32_t imm = reinterpret_cast<int32_t>(constant.raw());
2817 switch (op_kind()) { 2855 switch (op_kind()) {
2818 case Token::kADD: 2856 case Token::kADD:
2819 if (imm != 0) { 2857 if (imm != 0) {
2820 // Checking overflow without emitting an instruction would be wrong. 2858 // Checking overflow without emitting an instruction would be wrong.
(...skipping 3707 matching lines...) Expand 10 before | Expand all | Expand 10 after
6528 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6566 __ movl(EDX, Immediate(kInvalidObjectPointer));
6529 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6567 __ movl(EDX, Immediate(kInvalidObjectPointer));
6530 #endif 6568 #endif
6531 } 6569 }
6532 6570
6533 } // namespace dart 6571 } // namespace dart
6534 6572
6535 #undef __ 6573 #undef __
6536 6574
6537 #endif // defined TARGET_ARCH_IA32 6575 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698