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

Side by Side Diff: runtime/vm/intermediate_language_arm.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/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language_arm64.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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/flow_graph.h" 12 #include "vm/flow_graph.h"
13 #include "vm/flow_graph_compiler.h" 13 #include "vm/flow_graph_compiler.h"
14 #include "vm/flow_graph_range_analysis.h" 14 #include "vm/flow_graph_range_analysis.h"
15 #include "vm/locations.h" 15 #include "vm/locations.h"
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #include "vm/parser.h" 17 #include "vm/parser.h"
18 #include "vm/simulator.h" 18 #include "vm/simulator.h"
19 #include "vm/stack_frame.h" 19 #include "vm/stack_frame.h"
20 #include "vm/stub_code.h" 20 #include "vm/stub_code.h"
21 #include "vm/symbols.h" 21 #include "vm/symbols.h"
22 22
23 #define __ compiler->assembler()-> 23 #define __ compiler->assembler()->
24 24
25 namespace dart { 25 namespace dart {
26 26
27 DECLARE_FLAG(bool, emit_edge_counters); 27 DECLARE_FLAG(bool, emit_edge_counters);
28 DECLARE_FLAG(bool, enable_asserts);
29 DECLARE_FLAG(bool, enable_type_checks);
28 DECLARE_FLAG(int, optimization_counter_threshold); 30 DECLARE_FLAG(int, optimization_counter_threshold);
29 DECLARE_FLAG(bool, propagate_ic_data); 31 DECLARE_FLAG(bool, propagate_ic_data);
30 DECLARE_FLAG(bool, use_osr); 32 DECLARE_FLAG(bool, use_osr);
31 33
32 // Generic summary for call instructions that have all arguments pushed 34 // Generic summary for call instructions that have all arguments pushed
33 // on the stack and return the result in a fixed register R0. 35 // on the stack and return the result in a fixed register R0.
34 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { 36 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) {
35 LocationSummary* result = new(isolate) LocationSummary( 37 LocationSummary* result = new(isolate) LocationSummary(
36 isolate, 0, 0, LocationSummary::kCall); 38 isolate, 0, 0, LocationSummary::kCall);
37 result->set_out(0, Location::RegisterLocation(R0)); 39 result->set_out(0, Location::RegisterLocation(R0));
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 371
370 static void EmitAssertBoolean(Register reg, 372 static void EmitAssertBoolean(Register reg,
371 intptr_t token_pos, 373 intptr_t token_pos,
372 intptr_t deopt_id, 374 intptr_t deopt_id,
373 LocationSummary* locs, 375 LocationSummary* locs,
374 FlowGraphCompiler* compiler) { 376 FlowGraphCompiler* compiler) {
375 // Check that the type of the value is allowed in conditional context. 377 // Check that the type of the value is allowed in conditional context.
376 // Call the runtime if the object is not bool::true or bool::false. 378 // Call the runtime if the object is not bool::true or bool::false.
377 ASSERT(locs->always_calls()); 379 ASSERT(locs->always_calls());
378 Label done; 380 Label done;
379 __ CompareObject(reg, Bool::True()); 381
380 __ b(&done, EQ); 382 if (FLAG_enable_type_checks) {
381 __ CompareObject(reg, Bool::False()); 383 __ CompareObject(reg, Bool::True());
382 __ b(&done, EQ); 384 __ b(&done, EQ);
385 __ CompareObject(reg, Bool::False());
386 __ b(&done, EQ);
387 } else {
388 ASSERT(FLAG_enable_asserts);
389 __ CompareObject(reg, Object::null_instance());
390 __ b(&done, NE);
391 }
383 392
384 __ Push(reg); // Push the source object. 393 __ Push(reg); // Push the source object.
385 compiler->GenerateRuntimeCall(token_pos, 394 compiler->GenerateRuntimeCall(token_pos,
386 deopt_id, 395 deopt_id,
387 kNonBoolTypeErrorRuntimeEntry, 396 kNonBoolTypeErrorRuntimeEntry,
388 1, 397 1,
389 locs); 398 locs);
390 // We should never return here. 399 // We should never return here.
391 __ bkpt(0); 400 __ bkpt(0);
392 __ Bind(&done); 401 __ Bind(&done);
(...skipping 6509 matching lines...) Expand 10 before | Expand all | Expand 10 after
6902 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 6911 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
6903 #if defined(DEBUG) 6912 #if defined(DEBUG)
6904 __ LoadImmediate(R4, kInvalidObjectPointer); 6913 __ LoadImmediate(R4, kInvalidObjectPointer);
6905 __ LoadImmediate(R5, kInvalidObjectPointer); 6914 __ LoadImmediate(R5, kInvalidObjectPointer);
6906 #endif 6915 #endif
6907 } 6916 }
6908 6917
6909 } // namespace dart 6918 } // namespace dart
6910 6919
6911 #endif // defined TARGET_ARCH_ARM 6920 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698