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

Side by Side Diff: src/ic/arm/ic-arm.cc

Issue 1700993002: Remove strong mode support from property loads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment. Created 4 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
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/ic/arm64/ic-arm64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/ic/ic.h" 8 #include "src/ic/ic.h"
9 #include "src/ic/ic-compiler.h" 9 #include "src/ic/ic-compiler.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 __ ldrb(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset)); 150 __ ldrb(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset));
151 __ cmp(scratch, Operand(JS_OBJECT_TYPE)); 151 __ cmp(scratch, Operand(JS_OBJECT_TYPE));
152 __ b(lt, slow); 152 __ b(lt, slow);
153 } 153 }
154 154
155 155
156 // Loads an indexed element from a fast case array. 156 // Loads an indexed element from a fast case array.
157 static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver, 157 static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver,
158 Register key, Register elements, 158 Register key, Register elements,
159 Register scratch1, Register scratch2, 159 Register scratch1, Register scratch2,
160 Register result, Label* slow, 160 Register result, Label* slow) {
161 LanguageMode language_mode) {
162 // Register use: 161 // Register use:
163 // 162 //
164 // receiver - holds the receiver on entry. 163 // receiver - holds the receiver on entry.
165 // Unchanged unless 'result' is the same register. 164 // Unchanged unless 'result' is the same register.
166 // 165 //
167 // key - holds the smi key on entry. 166 // key - holds the smi key on entry.
168 // Unchanged unless 'result' is the same register. 167 // Unchanged unless 'result' is the same register.
169 // 168 //
170 // result - holds the result on exit if the load succeeded. 169 // result - holds the result on exit if the load succeeded.
171 // Allowed to be the the same as 'receiver' or 'key'. 170 // Allowed to be the the same as 'receiver' or 'key'.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 __ b(lo, slow); 207 __ b(lo, slow);
209 __ ldrb(scratch1, FieldMemOperand(scratch2, Map::kBitFieldOffset)); 208 __ ldrb(scratch1, FieldMemOperand(scratch2, Map::kBitFieldOffset));
210 __ tst(scratch1, Operand((1 << Map::kIsAccessCheckNeeded) | 209 __ tst(scratch1, Operand((1 << Map::kIsAccessCheckNeeded) |
211 (1 << Map::kHasIndexedInterceptor))); 210 (1 << Map::kHasIndexedInterceptor)));
212 __ b(ne, slow); 211 __ b(ne, slow);
213 __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex); 212 __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex);
214 __ b(ne, slow); 213 __ b(ne, slow);
215 __ jmp(&check_next_prototype); 214 __ jmp(&check_next_prototype);
216 215
217 __ bind(&absent); 216 __ bind(&absent);
218 if (is_strong(language_mode)) { 217 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
219 // Strong mode accesses must throw in this case, so call the runtime. 218 __ jmp(&done);
220 __ jmp(slow);
221 } else {
222 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
223 __ jmp(&done);
224 }
225 219
226 __ bind(&in_bounds); 220 __ bind(&in_bounds);
227 // Fast case: Do the load. 221 // Fast case: Do the load.
228 __ add(scratch1, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 222 __ add(scratch1, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
229 __ ldr(scratch2, MemOperand::PointerAddressFromSmiKey(scratch1, key)); 223 __ ldr(scratch2, MemOperand::PointerAddressFromSmiKey(scratch1, key));
230 __ CompareRoot(scratch2, Heap::kTheHoleValueRootIndex); 224 __ CompareRoot(scratch2, Heap::kTheHoleValueRootIndex);
231 // In case the loaded value is the_hole we have to check the prototype chain. 225 // In case the loaded value is the_hole we have to check the prototype chain.
232 __ b(eq, &check_prototypes); 226 __ b(eq, &check_prototypes);
233 __ mov(result, scratch2); 227 __ mov(result, scratch2);
234 __ bind(&done); 228 __ bind(&done);
(...skipping 22 matching lines...) Expand all
257 // bit test is enough. 251 // bit test is enough.
258 // map: key map 252 // map: key map
259 __ ldrb(hash, FieldMemOperand(map, Map::kInstanceTypeOffset)); 253 __ ldrb(hash, FieldMemOperand(map, Map::kInstanceTypeOffset));
260 STATIC_ASSERT(kInternalizedTag == 0); 254 STATIC_ASSERT(kInternalizedTag == 0);
261 __ tst(hash, Operand(kIsNotInternalizedMask)); 255 __ tst(hash, Operand(kIsNotInternalizedMask));
262 __ b(ne, not_unique); 256 __ b(ne, not_unique);
263 257
264 __ bind(&unique); 258 __ bind(&unique);
265 } 259 }
266 260
267 261 void LoadIC::GenerateNormal(MacroAssembler* masm) {
268 void LoadIC::GenerateNormal(MacroAssembler* masm, LanguageMode language_mode) {
269 Register dictionary = r0; 262 Register dictionary = r0;
270 DCHECK(!dictionary.is(LoadDescriptor::ReceiverRegister())); 263 DCHECK(!dictionary.is(LoadDescriptor::ReceiverRegister()));
271 DCHECK(!dictionary.is(LoadDescriptor::NameRegister())); 264 DCHECK(!dictionary.is(LoadDescriptor::NameRegister()));
272 265
273 Label slow; 266 Label slow;
274 267
275 __ ldr(dictionary, FieldMemOperand(LoadDescriptor::ReceiverRegister(), 268 __ ldr(dictionary, FieldMemOperand(LoadDescriptor::ReceiverRegister(),
276 JSObject::kPropertiesOffset)); 269 JSObject::kPropertiesOffset));
277 GenerateDictionaryLoad(masm, &slow, dictionary, 270 GenerateDictionaryLoad(masm, &slow, dictionary,
278 LoadDescriptor::NameRegister(), r0, r3, r4); 271 LoadDescriptor::NameRegister(), r0, r3, r4);
279 __ Ret(); 272 __ Ret();
280 273
281 // Dictionary load failed, go slow (but don't miss). 274 // Dictionary load failed, go slow (but don't miss).
282 __ bind(&slow); 275 __ bind(&slow);
283 GenerateRuntimeGetProperty(masm, language_mode); 276 GenerateRuntimeGetProperty(masm);
284 } 277 }
285 278
286 279
287 // A register that isn't one of the parameters to the load ic. 280 // A register that isn't one of the parameters to the load ic.
288 static const Register LoadIC_TempRegister() { return r3; } 281 static const Register LoadIC_TempRegister() { return r3; }
289 282
290 283
291 static void LoadIC_PushArgs(MacroAssembler* masm) { 284 static void LoadIC_PushArgs(MacroAssembler* masm) {
292 Register receiver = LoadDescriptor::ReceiverRegister(); 285 Register receiver = LoadDescriptor::ReceiverRegister();
293 Register name = LoadDescriptor::NameRegister(); 286 Register name = LoadDescriptor::NameRegister();
(...skipping 11 matching lines...) Expand all
305 DCHECK(!AreAliased(r4, r5, LoadWithVectorDescriptor::SlotRegister(), 298 DCHECK(!AreAliased(r4, r5, LoadWithVectorDescriptor::SlotRegister(),
306 LoadWithVectorDescriptor::VectorRegister())); 299 LoadWithVectorDescriptor::VectorRegister()));
307 __ IncrementCounter(isolate->counters()->ic_load_miss(), 1, r4, r5); 300 __ IncrementCounter(isolate->counters()->ic_load_miss(), 1, r4, r5);
308 301
309 LoadIC_PushArgs(masm); 302 LoadIC_PushArgs(masm);
310 303
311 // Perform tail call to the entry. 304 // Perform tail call to the entry.
312 __ TailCallRuntime(Runtime::kLoadIC_Miss); 305 __ TailCallRuntime(Runtime::kLoadIC_Miss);
313 } 306 }
314 307
315 308 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
316 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm,
317 LanguageMode language_mode) {
318 // The return address is in lr. 309 // The return address is in lr.
319 310
320 __ mov(LoadIC_TempRegister(), LoadDescriptor::ReceiverRegister()); 311 __ mov(LoadIC_TempRegister(), LoadDescriptor::ReceiverRegister());
321 __ Push(LoadIC_TempRegister(), LoadDescriptor::NameRegister()); 312 __ Push(LoadIC_TempRegister(), LoadDescriptor::NameRegister());
322 313
323 // Do tail-call to runtime routine. 314 // Do tail-call to runtime routine.
324 __ TailCallRuntime(is_strong(language_mode) ? Runtime::kGetPropertyStrong 315 __ TailCallRuntime(Runtime::kGetProperty);
325 : Runtime::kGetProperty);
326 } 316 }
327 317
328 318
329 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 319 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
330 // The return address is in lr. 320 // The return address is in lr.
331 Isolate* isolate = masm->isolate(); 321 Isolate* isolate = masm->isolate();
332 322
333 DCHECK(!AreAliased(r4, r5, LoadWithVectorDescriptor::SlotRegister(), 323 DCHECK(!AreAliased(r4, r5, LoadWithVectorDescriptor::SlotRegister(),
334 LoadWithVectorDescriptor::VectorRegister())); 324 LoadWithVectorDescriptor::VectorRegister()));
335 __ IncrementCounter(isolate->counters()->ic_keyed_load_miss(), 1, r4, r5); 325 __ IncrementCounter(isolate->counters()->ic_keyed_load_miss(), 1, r4, r5);
336 326
337 LoadIC_PushArgs(masm); 327 LoadIC_PushArgs(masm);
338 328
339 // Perform tail call to the entry. 329 // Perform tail call to the entry.
340 __ TailCallRuntime(Runtime::kKeyedLoadIC_Miss); 330 __ TailCallRuntime(Runtime::kKeyedLoadIC_Miss);
341 } 331 }
342 332
343 333 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
344 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm,
345 LanguageMode language_mode) {
346 // The return address is in lr. 334 // The return address is in lr.
347 335
348 __ Push(LoadDescriptor::ReceiverRegister(), LoadDescriptor::NameRegister()); 336 __ Push(LoadDescriptor::ReceiverRegister(), LoadDescriptor::NameRegister());
349 337
350 // Perform tail call to the entry. 338 // Perform tail call to the entry.
351 // Do tail-call to runtime routine. 339 // Do tail-call to runtime routine.
352 __ TailCallRuntime(is_strong(language_mode) ? Runtime::kKeyedGetPropertyStrong 340 __ TailCallRuntime(Runtime::kKeyedGetProperty);
353 : Runtime::kKeyedGetProperty);
354 } 341 }
355 342
356 343 void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) {
357 void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm,
358 LanguageMode language_mode) {
359 // The return address is in lr. 344 // The return address is in lr.
360 Label slow, check_name, index_smi, index_name, property_array_property; 345 Label slow, check_name, index_smi, index_name, property_array_property;
361 Label probe_dictionary, check_number_dictionary; 346 Label probe_dictionary, check_number_dictionary;
362 347
363 Register key = LoadDescriptor::NameRegister(); 348 Register key = LoadDescriptor::NameRegister();
364 Register receiver = LoadDescriptor::ReceiverRegister(); 349 Register receiver = LoadDescriptor::ReceiverRegister();
365 DCHECK(key.is(r2)); 350 DCHECK(key.is(r2));
366 DCHECK(receiver.is(r1)); 351 DCHECK(receiver.is(r1));
367 352
368 Isolate* isolate = masm->isolate(); 353 Isolate* isolate = masm->isolate();
369 354
370 // Check that the key is a smi. 355 // Check that the key is a smi.
371 __ JumpIfNotSmi(key, &check_name); 356 __ JumpIfNotSmi(key, &check_name);
372 __ bind(&index_smi); 357 __ bind(&index_smi);
373 // Now the key is known to be a smi. This place is also jumped to from below 358 // Now the key is known to be a smi. This place is also jumped to from below
374 // where a numeric string is converted to a smi. 359 // where a numeric string is converted to a smi.
375 360
376 GenerateKeyedLoadReceiverCheck(masm, receiver, r0, r3, 361 GenerateKeyedLoadReceiverCheck(masm, receiver, r0, r3,
377 Map::kHasIndexedInterceptor, &slow); 362 Map::kHasIndexedInterceptor, &slow);
378 363
379 // Check the receiver's map to see if it has fast elements. 364 // Check the receiver's map to see if it has fast elements.
380 __ CheckFastElements(r0, r3, &check_number_dictionary); 365 __ CheckFastElements(r0, r3, &check_number_dictionary);
381 366
382 GenerateFastArrayLoad(masm, receiver, key, r0, r3, r4, r0, &slow, 367 GenerateFastArrayLoad(masm, receiver, key, r0, r3, r4, r0, &slow);
383 language_mode);
384 __ IncrementCounter(isolate->counters()->ic_keyed_load_generic_smi(), 1, r4, 368 __ IncrementCounter(isolate->counters()->ic_keyed_load_generic_smi(), 1, r4,
385 r3); 369 r3);
386 __ Ret(); 370 __ Ret();
387 371
388 __ bind(&check_number_dictionary); 372 __ bind(&check_number_dictionary);
389 __ ldr(r4, FieldMemOperand(receiver, JSObject::kElementsOffset)); 373 __ ldr(r4, FieldMemOperand(receiver, JSObject::kElementsOffset));
390 __ ldr(r3, FieldMemOperand(r4, JSObject::kMapOffset)); 374 __ ldr(r3, FieldMemOperand(r4, JSObject::kMapOffset));
391 375
392 // Check whether the elements is a number dictionary. 376 // Check whether the elements is a number dictionary.
393 // r3: elements map 377 // r3: elements map
394 // r4: elements 378 // r4: elements
395 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); 379 __ LoadRoot(ip, Heap::kHashTableMapRootIndex);
396 __ cmp(r3, ip); 380 __ cmp(r3, ip);
397 __ b(ne, &slow); 381 __ b(ne, &slow);
398 __ SmiUntag(r0, key); 382 __ SmiUntag(r0, key);
399 __ LoadFromNumberDictionary(&slow, r4, key, r0, r0, r3, r5); 383 __ LoadFromNumberDictionary(&slow, r4, key, r0, r0, r3, r5);
400 __ Ret(); 384 __ Ret();
401 385
402 // Slow case, key and receiver still in r2 and r1. 386 // Slow case, key and receiver still in r2 and r1.
403 __ bind(&slow); 387 __ bind(&slow);
404 __ IncrementCounter(isolate->counters()->ic_keyed_load_generic_slow(), 1, r4, 388 __ IncrementCounter(isolate->counters()->ic_keyed_load_generic_slow(), 1, r4,
405 r3); 389 r3);
406 GenerateRuntimeGetProperty(masm, language_mode); 390 GenerateRuntimeGetProperty(masm);
407 391
408 __ bind(&check_name); 392 __ bind(&check_name);
409 GenerateKeyNameCheck(masm, key, r0, r3, &index_name, &slow); 393 GenerateKeyNameCheck(masm, key, r0, r3, &index_name, &slow);
410 394
411 GenerateKeyedLoadReceiverCheck(masm, receiver, r0, r3, 395 GenerateKeyedLoadReceiverCheck(masm, receiver, r0, r3,
412 Map::kHasNamedInterceptor, &slow); 396 Map::kHasNamedInterceptor, &slow);
413 397
414 // If the receiver is a fast-case object, check the stub cache. Otherwise 398 // If the receiver is a fast-case object, check the stub cache. Otherwise
415 // probe the dictionary. 399 // probe the dictionary.
416 __ ldr(r3, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 400 __ ldr(r3, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 patcher.EmitCondition(ne); 879 patcher.EmitCondition(ne);
896 } else { 880 } else {
897 DCHECK(Assembler::GetCondition(branch_instr) == ne); 881 DCHECK(Assembler::GetCondition(branch_instr) == ne);
898 patcher.EmitCondition(eq); 882 patcher.EmitCondition(eq);
899 } 883 }
900 } 884 }
901 } // namespace internal 885 } // namespace internal
902 } // namespace v8 886 } // namespace v8
903 887
904 #endif // V8_TARGET_ARCH_ARM 888 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/ic/arm64/ic-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698