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

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

Issue 883263004: Allows turning on checked mode on a per-isolate basis (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 months 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/intrinsifier.h" 8 #include "vm/intrinsifier.h"
9 9
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/flow_graph_compiler.h" 12 #include "vm/flow_graph_compiler.h"
13 #include "vm/object.h" 13 #include "vm/object.h"
14 #include "vm/object_store.h" 14 #include "vm/object_store.h"
15 #include "vm/regexp_assembler.h" 15 #include "vm/regexp_assembler.h"
16 #include "vm/symbols.h" 16 #include "vm/symbols.h"
17 17
18 namespace dart { 18 namespace dart {
19 19
20 DECLARE_FLAG(bool, enable_type_checks); 20 DECLARE_FLAG(bool, enable_type_checks);
21 21
22 22
23 #define __ assembler-> 23 #define __ assembler->
24 24
25 25
26 intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; } 26 intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; }
27 27
28 28
29 static bool TypeChecksEnabled() {
30 return FLAG_enable_type_checks || Isolate::Current()->checked_mode();
31 }
32
33
29 static intptr_t ComputeObjectArrayTypeArgumentsOffset() { 34 static intptr_t ComputeObjectArrayTypeArgumentsOffset() {
30 const Library& core_lib = Library::Handle(Library::CoreLibrary()); 35 const Library& core_lib = Library::Handle(Library::CoreLibrary());
31 const Class& cls = Class::Handle( 36 const Class& cls = Class::Handle(
32 core_lib.LookupClassAllowPrivate(Symbols::_List())); 37 core_lib.LookupClassAllowPrivate(Symbols::_List()));
33 ASSERT(!cls.IsNull()); 38 ASSERT(!cls.IsNull());
34 ASSERT(cls.NumTypeArguments() == 1); 39 ASSERT(cls.NumTypeArguments() == 1);
35 const intptr_t field_offset = cls.type_arguments_field_offset(); 40 const intptr_t field_offset = cls.type_arguments_field_offset();
36 ASSERT(field_offset != Class::kNoTypeArguments); 41 ASSERT(field_offset != Class::kNoTypeArguments);
37 return field_offset; 42 return field_offset;
38 } 43 }
39 44
40 45
41 // Intrinsify only for Smi value and index. Non-smi values need a store buffer 46 // Intrinsify only for Smi value and index. Non-smi values need a store buffer
42 // update. Array length is always a Smi. 47 // update. Array length is always a Smi.
43 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { 48 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) {
44 Label fall_through; 49 Label fall_through;
45 50
46 if (FLAG_enable_type_checks) { 51 if (TypeChecksEnabled()) {
47 const intptr_t type_args_field_offset = 52 const intptr_t type_args_field_offset =
48 ComputeObjectArrayTypeArgumentsOffset(); 53 ComputeObjectArrayTypeArgumentsOffset();
49 // Inline simple tests (Smi, null), fallthrough if not positive. 54 // Inline simple tests (Smi, null), fallthrough if not positive.
50 Label checked_ok; 55 Label checked_ok;
51 __ ldr(R2, Address(SP, 0 * kWordSize)); // Value. 56 __ ldr(R2, Address(SP, 0 * kWordSize)); // Value.
52 57
53 // Null value is valid for any type. 58 // Null value is valid for any type.
54 __ CompareObject(R2, Object::null_object(), PP); 59 __ CompareObject(R2, Object::null_object(), PP);
55 __ b(&checked_ok, EQ); 60 __ b(&checked_ok, EQ);
56 61
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 142
138 __ Bind(&fall_through); 143 __ Bind(&fall_through);
139 } 144 }
140 145
141 146
142 // Add an element to growable array if it doesn't need to grow, otherwise 147 // Add an element to growable array if it doesn't need to grow, otherwise
143 // call into regular code. 148 // call into regular code.
144 // On stack: growable array (+1), value (+0). 149 // On stack: growable array (+1), value (+0).
145 void Intrinsifier::GrowableArray_add(Assembler* assembler) { 150 void Intrinsifier::GrowableArray_add(Assembler* assembler) {
146 // In checked mode we need to type-check the incoming argument. 151 // In checked mode we need to type-check the incoming argument.
147 if (FLAG_enable_type_checks) { 152 if (TypeChecksEnabled()) {
148 return; 153 return;
149 } 154 }
150 Label fall_through; 155 Label fall_through;
151 // R0: Array. 156 // R0: Array.
152 __ ldr(R0, Address(SP, 1 * kWordSize)); 157 __ ldr(R0, Address(SP, 1 * kWordSize));
153 // R1: length. 158 // R1: length.
154 __ ldr(R1, FieldAddress(R0, GrowableObjectArray::length_offset())); 159 __ ldr(R1, FieldAddress(R0, GrowableObjectArray::length_offset()));
155 // R2: data. 160 // R2: data.
156 __ ldr(R2, FieldAddress(R0, GrowableObjectArray::data_offset())); 161 __ ldr(R2, FieldAddress(R0, GrowableObjectArray::data_offset()));
157 // R3: capacity. 162 // R3: capacity.
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 Isolate* isolate = Isolate::Current(); 2031 Isolate* isolate = Isolate::Current();
2027 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); 2032 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP);
2028 // Set return value to Isolate::current_tag_. 2033 // Set return value to Isolate::current_tag_.
2029 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 2034 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
2030 __ ret(); 2035 __ ret();
2031 } 2036 }
2032 2037
2033 } // namespace dart 2038 } // namespace dart
2034 2039
2035 #endif // defined TARGET_ARCH_ARM64 2040 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698