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

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

Issue 10540040: Inline setters, getters, various cleanups & restructuring. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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_ia32.cc ('k') | runtime/vm/object.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
11 #include "vm/flow_graph_compiler.h" 11 #include "vm/flow_graph_compiler.h"
12 #include "vm/locations.h" 12 #include "vm/locations.h"
13 #include "vm/object_store.h" 13 #include "vm/object_store.h"
14 #include "vm/parser.h" 14 #include "vm/parser.h"
15 #include "vm/stub_code.h" 15 #include "vm/stub_code.h"
16 16
17 #define __ compiler->assembler()-> 17 #define __ compiler->assembler()->
18 18
19 namespace dart { 19 namespace dart {
20 20
21 DECLARE_FLAG(int, optimization_counter_threshold); 21 DECLARE_FLAG(int, optimization_counter_threshold);
22 DECLARE_FLAG(bool, trace_functions); 22 DECLARE_FLAG(bool, trace_functions);
23 23
24
25 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 24 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
26 computation()->EmitNativeCode(compiler); 25 computation()->EmitNativeCode(compiler);
27 __ pushq(locs()->out().reg()); 26 __ pushq(locs()->out().reg());
28 } 27 }
29 28
30 29
31 LocationSummary* ReturnInstr::MakeLocationSummary() const { 30 LocationSummary* ReturnInstr::MakeLocationSummary() const {
32 const intptr_t kNumInputs = 1; 31 const intptr_t kNumInputs = 1;
33 const intptr_t kNumTemps = 1; 32 const intptr_t kNumTemps = 1;
34 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); 33 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 try_index(), 301 try_index(),
303 function_name, 302 function_name,
304 kNumArguments, 303 kNumArguments,
305 Array::ZoneHandle(), // No optional arguments. 304 Array::ZoneHandle(), // No optional arguments.
306 kNumArgsChecked); 305 kNumArgsChecked);
307 } 306 }
308 307
309 308
310 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { 309 LocationSummary* InstanceSetterComp::MakeLocationSummary() const {
311 const intptr_t kNumInputs = 2; 310 const intptr_t kNumInputs = 2;
312 return LocationSummary::Make(kNumInputs, Location::RequiresRegister()); 311 return LocationSummary::Make(kNumInputs, Location::NoLocation());
313 return NULL; 312 return NULL;
314 } 313 }
315 314
316 315
317 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { 316 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
318 Register receiver = locs()->in(0).reg(); 317 Register receiver = locs()->in(0).reg();
319 Register value = locs()->in(1).reg(); 318 Register value = locs()->in(1).reg();
320 Register result = locs()->out().reg();
321 319
322 // Preserve the value (second argument) under the arguments as the result 320 // Preserve the value (second argument) under the arguments as the result
323 // of the computation, then call the setter. 321 // of the computation, then call the setter.
324 const String& function_name = 322 const String& function_name =
325 String::ZoneHandle(Field::SetterSymbol(field_name())); 323 String::ZoneHandle(Field::SetterSymbol(field_name()));
326 324
327 // Insert a copy of the second (last) argument under the arguments.
328 // TODO(fschneider): Avoid preserving the value if the result is not used.
329 __ pushq(value);
330 __ pushq(receiver); 325 __ pushq(receiver);
331 __ pushq(value); 326 __ pushq(value);
327 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
328 cid(),
329 token_index(),
330 try_index());
332 const intptr_t kArgumentCount = 2; 331 const intptr_t kArgumentCount = 2;
333 const intptr_t kCheckedArgumentCount = 1; 332 const intptr_t kCheckedArgumentCount = 1;
334 compiler->GenerateInstanceCall(cid(), 333 compiler->GenerateInstanceCall(cid(),
335 token_index(), 334 token_index(),
336 try_index(), 335 try_index(),
337 function_name, 336 function_name,
338 kArgumentCount, 337 kArgumentCount,
339 Array::ZoneHandle(), 338 Array::ZoneHandle(),
340 kCheckedArgumentCount); 339 kCheckedArgumentCount);
341 __ popq(result);
342 } 340 }
343 341
344 342
345 LocationSummary* StaticSetterComp::MakeLocationSummary() const { 343 LocationSummary* StaticSetterComp::MakeLocationSummary() const {
346 const intptr_t kNumInputs = 1; 344 const intptr_t kNumInputs = 1;
347 return LocationSummary::Make(kNumInputs, Location::RequiresRegister()); 345 return LocationSummary::Make(kNumInputs, Location::RequiresRegister());
348 } 346 }
349 347
350 348
351 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { 349 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 23 matching lines...) Expand all
375 // is not used after the result is defined. We should consider adding 373 // is not used after the result is defined. We should consider adding
376 // this information to the input policy. 374 // this information to the input policy.
377 return LocationSummary::Make(1, Location::RequiresRegister()); 375 return LocationSummary::Make(1, Location::RequiresRegister());
378 } 376 }
379 377
380 378
381 void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { 379 void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
382 Register instance = locs()->in(0).reg(); 380 Register instance = locs()->in(0).reg();
383 Register result = locs()->out().reg(); 381 Register result = locs()->out().reg();
384 382
383 if (class_ids() != NULL) {
384 ASSERT(original() != NULL);
385 Label* deopt = compiler->AddDeoptStub(original()->cid(),
386 original()->token_index(),
387 original()->try_index(),
388 kDeoptInstanceGetterSameTarget,
389 instance,
390 kNoRegister);
391 // Smis do not have instance fields (Smi class is always first).
392 // Use 'result' as temporary register.
393 ASSERT(result != instance);
394 compiler->EmitClassChecksNoSmi(*class_ids(), instance, result, deopt);
395 }
385 __ movq(result, FieldAddress(instance, field().Offset())); 396 __ movq(result, FieldAddress(instance, field().Offset()));
386 } 397 }
387 398
388 399
389 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { 400 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const {
390 return LocationSummary::Make(0, Location::RequiresRegister()); 401 return LocationSummary::Make(0, Location::RequiresRegister());
391 } 402 }
392 403
393 404
394 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { 405 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 } else { 1075 } else {
1065 UNREACHABLE(); 1076 UNREACHABLE();
1066 } 1077 }
1067 } 1078 }
1068 1079
1069 } // namespace dart 1080 } // namespace dart
1070 1081
1071 #undef __ 1082 #undef __
1072 1083
1073 #endif // defined TARGET_ARCH_X64 1084 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698