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

Side by Side Diff: runtime/vm/intermediate_language_mips.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_ia32.cc ('k') | runtime/vm/intermediate_language_x64.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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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, propagate_ic_data); 30 DECLARE_FLAG(bool, propagate_ic_data);
29 DECLARE_FLAG(bool, use_osr); 31 DECLARE_FLAG(bool, use_osr);
30 32
31 // Generic summary for call instructions that have all arguments pushed 33 // Generic summary for call instructions that have all arguments pushed
32 // on the stack and return the result in a fixed register V0. 34 // on the stack and return the result in a fixed register V0.
33 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { 35 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) {
34 LocationSummary* result = new(isolate) LocationSummary( 36 LocationSummary* result = new(isolate) LocationSummary(
35 isolate, 0, 0, LocationSummary::kCall); 37 isolate, 0, 0, LocationSummary::kCall);
36 result->set_out(0, Location::RegisterLocation(V0)); 38 result->set_out(0, Location::RegisterLocation(V0));
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 393
392 static void EmitAssertBoolean(Register reg, 394 static void EmitAssertBoolean(Register reg,
393 intptr_t token_pos, 395 intptr_t token_pos,
394 intptr_t deopt_id, 396 intptr_t deopt_id,
395 LocationSummary* locs, 397 LocationSummary* locs,
396 FlowGraphCompiler* compiler) { 398 FlowGraphCompiler* compiler) {
397 // Check that the type of the value is allowed in conditional context. 399 // Check that the type of the value is allowed in conditional context.
398 // Call the runtime if the object is not bool::true or bool::false. 400 // Call the runtime if the object is not bool::true or bool::false.
399 ASSERT(locs->always_calls()); 401 ASSERT(locs->always_calls());
400 Label done; 402 Label done;
401 __ BranchEqual(reg, Bool::True(), &done); 403
402 __ BranchEqual(reg, Bool::False(), &done); 404 if (FLAG_enable_type_checks) {
405 __ BranchEqual(reg, Bool::True(), &done);
406 __ BranchEqual(reg, Bool::False(), &done);
407 } else {
408 ASSERT(FLAG_enable_asserts);
409 __ BranchNotEqual(reg, Object::null_instance(), &done);
410 }
403 411
404 __ Push(reg); // Push the source object. 412 __ Push(reg); // Push the source object.
405 compiler->GenerateRuntimeCall(token_pos, 413 compiler->GenerateRuntimeCall(token_pos,
406 deopt_id, 414 deopt_id,
407 kNonBoolTypeErrorRuntimeEntry, 415 kNonBoolTypeErrorRuntimeEntry,
408 1, 416 1,
409 locs); 417 locs);
410 // We should never return here. 418 // We should never return here.
411 __ break_(0); 419 __ break_(0);
412 __ Bind(&done); 420 __ Bind(&done);
(...skipping 5144 matching lines...) Expand 10 before | Expand all | Expand 10 after
5557 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5565 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
5558 #if defined(DEBUG) 5566 #if defined(DEBUG)
5559 __ LoadImmediate(S4, kInvalidObjectPointer); 5567 __ LoadImmediate(S4, kInvalidObjectPointer);
5560 __ LoadImmediate(S5, kInvalidObjectPointer); 5568 __ LoadImmediate(S5, kInvalidObjectPointer);
5561 #endif 5569 #endif
5562 } 5570 }
5563 5571
5564 } // namespace dart 5572 } // namespace dart
5565 5573
5566 #endif // defined TARGET_ARCH_MIPS 5574 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698