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

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

Issue 778063002: Implement correct semantics of Boolean Conversion (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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"
11 #include "vm/flow_graph.h" 11 #include "vm/flow_graph.h"
12 #include "vm/flow_graph_compiler.h" 12 #include "vm/flow_graph_compiler.h"
13 #include "vm/flow_graph_range_analysis.h" 13 #include "vm/flow_graph_range_analysis.h"
14 #include "vm/locations.h" 14 #include "vm/locations.h"
15 #include "vm/object_store.h" 15 #include "vm/object_store.h"
16 #include "vm/parser.h" 16 #include "vm/parser.h"
17 #include "vm/simulator.h" 17 #include "vm/simulator.h"
18 #include "vm/stack_frame.h" 18 #include "vm/stack_frame.h"
19 #include "vm/stub_code.h" 19 #include "vm/stub_code.h"
20 #include "vm/symbols.h" 20 #include "vm/symbols.h"
21 21
22 #define __ compiler->assembler()-> 22 #define __ compiler->assembler()->
23 23
24 namespace dart { 24 namespace dart {
25 25
26 DECLARE_FLAG(bool, emit_edge_counters); 26 DECLARE_FLAG(bool, emit_edge_counters);
27 DECLARE_FLAG(bool, enable_asserts);
28 DECLARE_FLAG(bool, enable_type_checks);
27 DECLARE_FLAG(int, optimization_counter_threshold); 29 DECLARE_FLAG(int, optimization_counter_threshold);
28 DECLARE_FLAG(bool, use_osr); 30 DECLARE_FLAG(bool, use_osr);
29 31
30 // Generic summary for call instructions that have all arguments pushed 32 // Generic summary for call instructions that have all arguments pushed
31 // on the stack and return the result in a fixed register R0. 33 // on the stack and return the result in a fixed register R0.
32 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { 34 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) {
33 LocationSummary* result = new(isolate) LocationSummary( 35 LocationSummary* result = new(isolate) LocationSummary(
34 isolate, 0, 0, LocationSummary::kCall); 36 isolate, 0, 0, LocationSummary::kCall);
35 result->set_out(0, Location::RegisterLocation(R0)); 37 result->set_out(0, Location::RegisterLocation(R0));
36 return result; 38 return result;
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 358
357 static void EmitAssertBoolean(Register reg, 359 static void EmitAssertBoolean(Register reg,
358 intptr_t token_pos, 360 intptr_t token_pos,
359 intptr_t deopt_id, 361 intptr_t deopt_id,
360 LocationSummary* locs, 362 LocationSummary* locs,
361 FlowGraphCompiler* compiler) { 363 FlowGraphCompiler* compiler) {
362 // Check that the type of the value is allowed in conditional context. 364 // Check that the type of the value is allowed in conditional context.
363 // Call the runtime if the object is not bool::true or bool::false. 365 // Call the runtime if the object is not bool::true or bool::false.
364 ASSERT(locs->always_calls()); 366 ASSERT(locs->always_calls());
365 Label done; 367 Label done;
366 __ CompareObject(reg, Bool::True(), PP); 368
367 __ b(&done, EQ); 369 if (FLAG_enable_type_checks) {
368 __ CompareObject(reg, Bool::False(), PP); 370 __ CompareObject(reg, Bool::True(), PP);
369 __ b(&done, EQ); 371 __ b(&done, EQ);
372 __ CompareObject(reg, Bool::False(), PP);
373 __ b(&done, EQ);
374 } else {
375 ASSERT(FLAG_enable_asserts);
376 __ CompareObject(reg, Object::null_instance(), PP);
377 __ b(&done, NE);
378 }
370 379
371 __ Push(reg); // Push the source object. 380 __ Push(reg); // Push the source object.
372 compiler->GenerateRuntimeCall(token_pos, 381 compiler->GenerateRuntimeCall(token_pos,
373 deopt_id, 382 deopt_id,
374 kNonBoolTypeErrorRuntimeEntry, 383 kNonBoolTypeErrorRuntimeEntry,
375 1, 384 1,
376 locs); 385 locs);
377 // We should never return here. 386 // We should never return here.
378 __ brk(0); 387 __ brk(0);
379 __ Bind(&done); 388 __ Bind(&done);
(...skipping 5211 matching lines...) Expand 10 before | Expand all | Expand 10 after
5591 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5600 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
5592 #if defined(DEBUG) 5601 #if defined(DEBUG)
5593 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); 5602 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP);
5594 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); 5603 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP);
5595 #endif 5604 #endif
5596 } 5605 }
5597 5606
5598 } // namespace dart 5607 } // namespace dart
5599 5608
5600 #endif // defined TARGET_ARCH_ARM64 5609 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698