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

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

Issue 668193002: Remove isolate pointer from context objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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
« no previous file with comments | « runtime/vm/stub_code_arm.cc ('k') | runtime/vm/stub_code_arm64_test.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) 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 26 matching lines...) Expand all
37 const intptr_t isolate_offset = NativeArguments::isolate_offset(); 37 const intptr_t isolate_offset = NativeArguments::isolate_offset();
38 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 38 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
39 const intptr_t argv_offset = NativeArguments::argv_offset(); 39 const intptr_t argv_offset = NativeArguments::argv_offset();
40 const intptr_t retval_offset = NativeArguments::retval_offset(); 40 const intptr_t retval_offset = NativeArguments::retval_offset();
41 const intptr_t exitframe_last_param_slot_from_fp = 1; 41 const intptr_t exitframe_last_param_slot_from_fp = 1;
42 42
43 __ SetPrologueOffset(); 43 __ SetPrologueOffset();
44 __ Comment("CallToRuntimeStub"); 44 __ Comment("CallToRuntimeStub");
45 __ EnterFrame(0); 45 __ EnterFrame(0);
46 46
47 // Load current Isolate pointer from Context structure into R0. 47 __ LoadIsolate(R0, kNoPP);
48 __ LoadFieldFromOffset(R0, CTX, Context::isolate_offset(), kNoPP);
49 48
50 // Save exit frame information to enable stack walking as we are about 49 // Save exit frame information to enable stack walking as we are about
51 // to transition to Dart VM C++ code. 50 // to transition to Dart VM C++ code.
52 __ StoreToOffset(SP, R0, Isolate::top_exit_frame_info_offset(), kNoPP); 51 __ StoreToOffset(SP, R0, Isolate::top_exit_frame_info_offset(), kNoPP);
53 52
54 // Save current Context pointer into Isolate structure. 53 // Save current Context pointer into Isolate structure.
55 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); 54 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP);
56 55
57 // Cache Isolate pointer into CTX while executing runtime code. 56 // Cache Isolate pointer into CTX while executing runtime code.
58 __ mov(CTX, R0); 57 __ mov(CTX, R0);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // R2 : address of first argument in argument array. 153 // R2 : address of first argument in argument array.
155 // R1 : argc_tag including number of arguments and function kind. 154 // R1 : argc_tag including number of arguments and function kind.
156 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { 155 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) {
157 const intptr_t isolate_offset = NativeArguments::isolate_offset(); 156 const intptr_t isolate_offset = NativeArguments::isolate_offset();
158 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 157 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
159 const intptr_t argv_offset = NativeArguments::argv_offset(); 158 const intptr_t argv_offset = NativeArguments::argv_offset();
160 const intptr_t retval_offset = NativeArguments::retval_offset(); 159 const intptr_t retval_offset = NativeArguments::retval_offset();
161 160
162 __ EnterFrame(0); 161 __ EnterFrame(0);
163 162
164 // Load current Isolate pointer from Context structure into R0. 163 __ LoadIsolate(R0, kNoPP);
165 __ LoadFieldFromOffset(R0, CTX, Context::isolate_offset(), kNoPP);
166 164
167 // Save exit frame information to enable stack walking as we are about 165 // Save exit frame information to enable stack walking as we are about
168 // to transition to native code. 166 // to transition to native code.
169 __ StoreToOffset(SP, R0, Isolate::top_exit_frame_info_offset(), kNoPP); 167 __ StoreToOffset(SP, R0, Isolate::top_exit_frame_info_offset(), kNoPP);
170 168
171 // Save current Context pointer into Isolate structure. 169 // Save current Context pointer into Isolate structure.
172 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); 170 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP);
173 171
174 // Cache Isolate pointer into CTX while executing native code. 172 // Cache Isolate pointer into CTX while executing native code.
175 __ mov(CTX, R0); 173 __ mov(CTX, R0);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // R2 : address of first argument in argument array. 269 // R2 : address of first argument in argument array.
272 // R1 : argc_tag including number of arguments and function kind. 270 // R1 : argc_tag including number of arguments and function kind.
273 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) { 271 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
274 const intptr_t isolate_offset = NativeArguments::isolate_offset(); 272 const intptr_t isolate_offset = NativeArguments::isolate_offset();
275 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 273 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
276 const intptr_t argv_offset = NativeArguments::argv_offset(); 274 const intptr_t argv_offset = NativeArguments::argv_offset();
277 const intptr_t retval_offset = NativeArguments::retval_offset(); 275 const intptr_t retval_offset = NativeArguments::retval_offset();
278 276
279 __ EnterFrame(0); 277 __ EnterFrame(0);
280 278
281 // Load current Isolate pointer from Context structure into R0. 279 __ LoadIsolate(R0, kNoPP);
282 __ LoadFieldFromOffset(R0, CTX, Context::isolate_offset(), kNoPP);
283 280
284 // Save exit frame information to enable stack walking as we are about 281 // Save exit frame information to enable stack walking as we are about
285 // to transition to native code. 282 // to transition to native code.
286 __ StoreToOffset(SP, R0, Isolate::top_exit_frame_info_offset(), kNoPP); 283 __ StoreToOffset(SP, R0, Isolate::top_exit_frame_info_offset(), kNoPP);
287 284
288 // Save current Context pointer into Isolate structure. 285 // Save current Context pointer into Isolate structure.
289 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); 286 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP);
290 287
291 // Cache Isolate pointer into CTX while executing native code. 288 // Cache Isolate pointer into CTX while executing native code.
292 __ mov(CTX, R0); 289 __ mov(CTX, R0);
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 __ LoadImmediate( 1044 __ LoadImmediate(
1048 TMP, RawObject::ClassIdTag::encode(cid), kNoPP); 1045 TMP, RawObject::ClassIdTag::encode(cid), kNoPP);
1049 __ orr(R2, R2, Operand(TMP)); 1046 __ orr(R2, R2, Operand(TMP));
1050 __ StoreFieldToOffset(R2, R0, Context::tags_offset(), kNoPP); 1047 __ StoreFieldToOffset(R2, R0, Context::tags_offset(), kNoPP);
1051 1048
1052 // Setup up number of context variables field. 1049 // Setup up number of context variables field.
1053 // R0: new object. 1050 // R0: new object.
1054 // R1: number of context variables as integer value (not object). 1051 // R1: number of context variables as integer value (not object).
1055 __ StoreFieldToOffset(R1, R0, Context::num_variables_offset(), kNoPP); 1052 __ StoreFieldToOffset(R1, R0, Context::num_variables_offset(), kNoPP);
1056 1053
1057 // Setup isolate field.
1058 // Load Isolate pointer into R2.
1059 // R0: new object.
1060 // R1: number of context variables.
1061 __ LoadIsolate(R2, kNoPP);
1062 // R2: isolate, not an object.
1063 __ StoreFieldToOffset(R2, R0, Context::isolate_offset(), kNoPP);
1064
1065 // Setup the parent field. 1054 // Setup the parent field.
1066 // R0: new object. 1055 // R0: new object.
1067 // R1: number of context variables. 1056 // R1: number of context variables.
1068 __ LoadObject(R2, Object::null_object(), PP); 1057 __ LoadObject(R2, Object::null_object(), PP);
1069 __ StoreFieldToOffset(R2, R0, Context::parent_offset(), kNoPP); 1058 __ StoreFieldToOffset(R2, R0, Context::parent_offset(), kNoPP);
1070 1059
1071 // Initialize the context variables. 1060 // Initialize the context variables.
1072 // R0: new object. 1061 // R0: new object.
1073 // R1: number of context variables. 1062 // R1: number of context variables.
1074 // R2: raw null. 1063 // R2: raw null.
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 __ Pop(R0); 1818 __ Pop(R0);
1830 __ LeaveStubFrame(); 1819 __ LeaveStubFrame();
1831 __ br(R0); 1820 __ br(R0);
1832 } 1821 }
1833 1822
1834 // Called only from unoptimized code. All relevant registers have been saved. 1823 // Called only from unoptimized code. All relevant registers have been saved.
1835 void StubCode::GenerateDebugStepCheckStub( 1824 void StubCode::GenerateDebugStepCheckStub(
1836 Assembler* assembler) { 1825 Assembler* assembler) {
1837 // Check single stepping. 1826 // Check single stepping.
1838 Label stepping, done_stepping; 1827 Label stepping, done_stepping;
1839 __ LoadFieldFromOffset(R1, CTX, Context::isolate_offset(), kNoPP); 1828 __ LoadIsolate(R1, kNoPP);
1840 __ LoadFromOffset( 1829 __ LoadFromOffset(
1841 R1, R1, Isolate::single_step_offset(), kNoPP, kUnsignedByte); 1830 R1, R1, Isolate::single_step_offset(), kNoPP, kUnsignedByte);
1842 __ CompareImmediate(R1, 0, kNoPP); 1831 __ CompareImmediate(R1, 0, kNoPP);
1843 __ b(&stepping, NE); 1832 __ b(&stepping, NE);
1844 __ Bind(&done_stepping); 1833 __ Bind(&done_stepping);
1845 1834
1846 __ ret(); 1835 __ ret();
1847 1836
1848 __ Bind(&stepping); 1837 __ Bind(&stepping);
1849 __ EnterStubFrame(); 1838 __ EnterStubFrame();
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 2070
2082 // Called only from unoptimized code. All relevant registers have been saved. 2071 // Called only from unoptimized code. All relevant registers have been saved.
2083 // LR: return address. 2072 // LR: return address.
2084 // SP + 4: left operand. 2073 // SP + 4: left operand.
2085 // SP + 0: right operand. 2074 // SP + 0: right operand.
2086 // Return Zero condition flag set if equal. 2075 // Return Zero condition flag set if equal.
2087 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( 2076 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub(
2088 Assembler* assembler) { 2077 Assembler* assembler) {
2089 // Check single stepping. 2078 // Check single stepping.
2090 Label stepping, done_stepping; 2079 Label stepping, done_stepping;
2091 __ LoadFieldFromOffset(R1, CTX, Context::isolate_offset(), kNoPP); 2080 __ LoadIsolate(R1, kNoPP);
2092 __ LoadFromOffset( 2081 __ LoadFromOffset(
2093 R1, R1, Isolate::single_step_offset(), kNoPP, kUnsignedByte); 2082 R1, R1, Isolate::single_step_offset(), kNoPP, kUnsignedByte);
2094 __ CompareImmediate(R1, 0, kNoPP); 2083 __ CompareImmediate(R1, 0, kNoPP);
2095 __ b(&stepping, NE); 2084 __ b(&stepping, NE);
2096 __ Bind(&done_stepping); 2085 __ Bind(&done_stepping);
2097 2086
2098 const Register left = R1; 2087 const Register left = R1;
2099 const Register right = R0; 2088 const Register right = R0;
2100 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); 2089 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP);
2101 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); 2090 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP);
(...skipping 20 matching lines...) Expand all
2122 const Register right = R0; 2111 const Register right = R0;
2123 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); 2112 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP);
2124 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); 2113 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP);
2125 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2114 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2126 __ ret(); 2115 __ ret();
2127 } 2116 }
2128 2117
2129 } // namespace dart 2118 } // namespace dart
2130 2119
2131 #endif // defined TARGET_ARCH_ARM64 2120 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm.cc ('k') | runtime/vm/stub_code_arm64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698