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

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
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 394
393 static void EmitAssertBoolean(Register reg, 395 static void EmitAssertBoolean(Register reg,
394 intptr_t token_pos, 396 intptr_t token_pos,
395 intptr_t deopt_id, 397 intptr_t deopt_id,
396 LocationSummary* locs, 398 LocationSummary* locs,
397 FlowGraphCompiler* compiler) { 399 FlowGraphCompiler* compiler) {
398 // Check that the type of the value is allowed in conditional context. 400 // Check that the type of the value is allowed in conditional context.
399 // Call the runtime if the object is not bool::true or bool::false. 401 // Call the runtime if the object is not bool::true or bool::false.
400 ASSERT(locs->always_calls()); 402 ASSERT(locs->always_calls());
401 Label done; 403 Label done;
402 __ BranchEqual(reg, Bool::True(), &done); 404
403 __ BranchEqual(reg, Bool::False(), &done); 405 if (FLAG_enable_type_checks) {
406 __ BranchEqual(reg, Bool::True(), &done);
407 __ BranchEqual(reg, Bool::False(), &done);
408 } else {
409 ASSERT(FLAG_enable_asserts);
410 __ BranchNotEqual(reg, Object::null_instance(), &done);
411 }
404 412
405 __ Push(reg); // Push the source object. 413 __ Push(reg); // Push the source object.
406 compiler->GenerateRuntimeCall(token_pos, 414 compiler->GenerateRuntimeCall(token_pos,
407 deopt_id, 415 deopt_id,
408 kNonBoolTypeErrorRuntimeEntry, 416 kNonBoolTypeErrorRuntimeEntry,
409 1, 417 1,
410 locs); 418 locs);
411 // We should never return here. 419 // We should never return here.
412 __ break_(0); 420 __ break_(0);
413 __ Bind(&done); 421 __ Bind(&done);
(...skipping 4557 matching lines...) Expand 10 before | Expand all | Expand 10 after
4971 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 4979 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4972 #if defined(DEBUG) 4980 #if defined(DEBUG)
4973 __ LoadImmediate(S4, kInvalidObjectPointer); 4981 __ LoadImmediate(S4, kInvalidObjectPointer);
4974 __ LoadImmediate(S5, kInvalidObjectPointer); 4982 __ LoadImmediate(S5, kInvalidObjectPointer);
4975 #endif 4983 #endif
4976 } 4984 }
4977 4985
4978 } // namespace dart 4986 } // namespace dart
4979 4987
4980 #endif // defined TARGET_ARCH_MIPS 4988 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698