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

Side by Side Diff: runtime/vm/intermediate_language_x64.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_mips.cc ('k') | tests/language/bool_check_test.dart » ('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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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, throw_on_javascript_int_overflow); 30 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
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 RAX. 34 // on the stack and return the result in a fixed register RAX.
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::Current(), 0, 0, LocationSummary::kCall); 37 Isolate::Current(), 0, 0, LocationSummary::kCall);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 324
323 static void EmitAssertBoolean(Register reg, 325 static void EmitAssertBoolean(Register reg,
324 intptr_t token_pos, 326 intptr_t token_pos,
325 intptr_t deopt_id, 327 intptr_t deopt_id,
326 LocationSummary* locs, 328 LocationSummary* locs,
327 FlowGraphCompiler* compiler) { 329 FlowGraphCompiler* compiler) {
328 // Check that the type of the value is allowed in conditional context. 330 // Check that the type of the value is allowed in conditional context.
329 // Call the runtime if the object is not bool::true or bool::false. 331 // Call the runtime if the object is not bool::true or bool::false.
330 ASSERT(locs->always_calls()); 332 ASSERT(locs->always_calls());
331 Label done; 333 Label done;
332 __ CompareObject(reg, Bool::True(), PP); 334
333 __ j(EQUAL, &done, Assembler::kNearJump); 335 if (FLAG_enable_type_checks) {
334 __ CompareObject(reg, Bool::False(), PP); 336 __ CompareObject(reg, Bool::True(), PP);
335 __ j(EQUAL, &done, Assembler::kNearJump); 337 __ j(EQUAL, &done, Assembler::kNearJump);
338 __ CompareObject(reg, Bool::False(), PP);
339 __ j(EQUAL, &done, Assembler::kNearJump);
340 } else {
341 ASSERT(FLAG_enable_asserts);
342 __ CompareObject(reg, Object::null_instance(), PP);
343 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
344 }
336 345
337 __ pushq(reg); // Push the source object. 346 __ pushq(reg); // Push the source object.
338 compiler->GenerateRuntimeCall(token_pos, 347 compiler->GenerateRuntimeCall(token_pos,
339 deopt_id, 348 deopt_id,
340 kNonBoolTypeErrorRuntimeEntry, 349 kNonBoolTypeErrorRuntimeEntry,
341 1, 350 1,
342 locs); 351 locs);
343 // We should never return here. 352 // We should never return here.
344 __ int3(); 353 __ int3();
345 __ Bind(&done); 354 __ Bind(&done);
(...skipping 6044 matching lines...) Expand 10 before | Expand all | Expand 10 after
6390 __ movq(R10, Immediate(kInvalidObjectPointer)); 6399 __ movq(R10, Immediate(kInvalidObjectPointer));
6391 __ movq(RBX, Immediate(kInvalidObjectPointer)); 6400 __ movq(RBX, Immediate(kInvalidObjectPointer));
6392 #endif 6401 #endif
6393 } 6402 }
6394 6403
6395 } // namespace dart 6404 } // namespace dart
6396 6405
6397 #undef __ 6406 #undef __
6398 6407
6399 #endif // defined TARGET_ARCH_X64 6408 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | tests/language/bool_check_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698