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

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

Issue 779253003: 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_arm64.cc ('k') | runtime/vm/intermediate_language_mips.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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/stack_frame.h" 17 #include "vm/stack_frame.h"
18 #include "vm/stub_code.h" 18 #include "vm/stub_code.h"
19 #include "vm/symbols.h" 19 #include "vm/symbols.h"
20 20
21 #define __ compiler->assembler()-> 21 #define __ compiler->assembler()->
22 22
23 namespace dart { 23 namespace dart {
24 24
25 DECLARE_FLAG(bool, emit_edge_counters); 25 DECLARE_FLAG(bool, emit_edge_counters);
26 DECLARE_FLAG(bool, enable_asserts);
27 DECLARE_FLAG(bool, enable_type_checks);
26 DECLARE_FLAG(int, optimization_counter_threshold); 28 DECLARE_FLAG(int, optimization_counter_threshold);
27 DECLARE_FLAG(bool, propagate_ic_data); 29 DECLARE_FLAG(bool, propagate_ic_data);
28 DECLARE_FLAG(bool, use_osr); 30 DECLARE_FLAG(bool, use_osr);
29 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 31 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
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 EAX. 34 // on the stack and return the result in a fixed register EAX.
33 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { 35 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) {
34 const intptr_t kNumInputs = 0; 36 const intptr_t kNumInputs = 0;
35 const intptr_t kNumTemps= 0; 37 const intptr_t kNumTemps = 0;
36 LocationSummary* result = new(isolate) LocationSummary( 38 LocationSummary* result = new(isolate) LocationSummary(
37 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 39 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
38 result->set_out(0, Location::RegisterLocation(EAX)); 40 result->set_out(0, Location::RegisterLocation(EAX));
39 return result; 41 return result;
40 } 42 }
41 43
42 44
43 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, 45 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate,
44 bool opt) const { 46 bool opt) const {
45 const intptr_t kNumInputs = 1; 47 const intptr_t kNumInputs = 1;
46 const intptr_t kNumTemps= 0; 48 const intptr_t kNumTemps = 0;
47 LocationSummary* locs = new(isolate) LocationSummary( 49 LocationSummary* locs = new(isolate) LocationSummary(
48 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 50 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
49 locs->set_in(0, Location::AnyOrConstant(value())); 51 locs->set_in(0, Location::AnyOrConstant(value()));
50 return locs; 52 return locs;
51 } 53 }
52 54
53 55
54 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 56 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
55 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode 57 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode
56 // where PushArgument is handled by BindInstr::EmitNativeCode. 58 // where PushArgument is handled by BindInstr::EmitNativeCode.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 243
242 static void EmitAssertBoolean(Register reg, 244 static void EmitAssertBoolean(Register reg,
243 intptr_t token_pos, 245 intptr_t token_pos,
244 intptr_t deopt_id, 246 intptr_t deopt_id,
245 LocationSummary* locs, 247 LocationSummary* locs,
246 FlowGraphCompiler* compiler) { 248 FlowGraphCompiler* compiler) {
247 // Check that the type of the value is allowed in conditional context. 249 // Check that the type of the value is allowed in conditional context.
248 // Call the runtime if the object is not bool::true or bool::false. 250 // Call the runtime if the object is not bool::true or bool::false.
249 ASSERT(locs->always_calls()); 251 ASSERT(locs->always_calls());
250 Label done; 252 Label done;
251 __ CompareObject(reg, Bool::True()); 253
252 __ j(EQUAL, &done, Assembler::kNearJump); 254 if (FLAG_enable_type_checks) {
253 __ CompareObject(reg, Bool::False()); 255 __ CompareObject(reg, Bool::True());
254 __ j(EQUAL, &done, Assembler::kNearJump); 256 __ j(EQUAL, &done, Assembler::kNearJump);
257 __ CompareObject(reg, Bool::False());
258 __ j(EQUAL, &done, Assembler::kNearJump);
259 } else {
260 ASSERT(FLAG_enable_asserts);
261 __ CompareObject(reg, Object::null_instance());
262 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
263 }
255 264
256 __ pushl(reg); // Push the source object. 265 __ pushl(reg); // Push the source object.
257 compiler->GenerateRuntimeCall(token_pos, 266 compiler->GenerateRuntimeCall(token_pos,
258 deopt_id, 267 deopt_id,
259 kNonBoolTypeErrorRuntimeEntry, 268 kNonBoolTypeErrorRuntimeEntry,
260 1, 269 1,
261 locs); 270 locs);
262 // We should never return here. 271 // We should never return here.
263 __ int3(); 272 __ int3();
264 __ Bind(&done); 273 __ Bind(&done);
(...skipping 6547 matching lines...) Expand 10 before | Expand all | Expand 10 after
6812 #if defined(DEBUG) 6821 #if defined(DEBUG)
6813 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6822 __ movl(EDX, Immediate(kInvalidObjectPointer));
6814 #endif 6823 #endif
6815 } 6824 }
6816 6825
6817 } // namespace dart 6826 } // namespace dart
6818 6827
6819 #undef __ 6828 #undef __
6820 6829
6821 #endif // defined TARGET_ARCH_IA32 6830 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698