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

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

Issue 1228063004: Fix keyed element access wrt string wrappers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/ic/arm64/ic-arm64.cc ('k') | src/ic/mips/ic-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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Check that the object isn't a smi. 150 // Check that the object isn't a smi.
151 __ JumpIfSmi(receiver, slow); 151 __ JumpIfSmi(receiver, slow);
152 152
153 // Get the map of the receiver. 153 // Get the map of the receiver.
154 __ mov(map, FieldOperand(receiver, HeapObject::kMapOffset)); 154 __ mov(map, FieldOperand(receiver, HeapObject::kMapOffset));
155 155
156 // Check bit field. 156 // Check bit field.
157 __ test_b(FieldOperand(map, Map::kBitFieldOffset), 157 __ test_b(FieldOperand(map, Map::kBitFieldOffset),
158 (1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit)); 158 (1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit));
159 __ j(not_zero, slow); 159 __ j(not_zero, slow);
160 // Check that the object is some kind of JS object EXCEPT JS Value type. 160 // Check that the object is some kind of JS object EXCEPT JS Value type. In
161 // In the case that the object is a value-wrapper object, 161 // the case that the object is a value-wrapper object, we enter the runtime
162 // we enter the runtime system to make sure that indexing 162 // system to make sure that indexing into string objects works as intended.
163 // into string objects works as intended.
164 DCHECK(JS_OBJECT_TYPE > JS_VALUE_TYPE); 163 DCHECK(JS_OBJECT_TYPE > JS_VALUE_TYPE);
165 164
166 __ CmpInstanceType(map, JS_OBJECT_TYPE); 165 __ CmpInstanceType(map, JS_OBJECT_TYPE);
167 __ j(below, slow); 166 __ j(below, slow);
168 } 167 }
169 168
170 169
171 // Loads an indexed element from a fast case array. 170 // Loads an indexed element from a fast case array.
172 static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver, 171 static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver,
173 Register key, Register scratch, 172 Register key, Register scratch,
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 __ mov(edi, FieldOperand(receiver, HeapObject::kMapOffset)); 531 __ mov(edi, FieldOperand(receiver, HeapObject::kMapOffset));
533 // Check that the receiver does not require access checks and is not observed. 532 // Check that the receiver does not require access checks and is not observed.
534 // The generic stub does not perform map checks or handle observed objects. 533 // The generic stub does not perform map checks or handle observed objects.
535 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), 534 __ test_b(FieldOperand(edi, Map::kBitFieldOffset),
536 1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved); 535 1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved);
537 __ j(not_zero, &slow); 536 __ j(not_zero, &slow);
538 // Check that the key is a smi. 537 // Check that the key is a smi.
539 __ JumpIfNotSmi(key, &maybe_name_key); 538 __ JumpIfNotSmi(key, &maybe_name_key);
540 __ CmpInstanceType(edi, JS_ARRAY_TYPE); 539 __ CmpInstanceType(edi, JS_ARRAY_TYPE);
541 __ j(equal, &array); 540 __ j(equal, &array);
542 // Check that the object is some kind of JSObject. 541 // Check that the object is some kind of JS object EXCEPT JS Value type. In
543 __ CmpInstanceType(edi, FIRST_JS_OBJECT_TYPE); 542 // the case that the object is a value-wrapper object, we enter the runtime
543 // system to make sure that indexing into string objects works as intended.
544 STATIC_ASSERT(JS_VALUE_TYPE < JS_OBJECT_TYPE);
545 __ CmpInstanceType(edi, JS_OBJECT_TYPE);
544 __ j(below, &slow); 546 __ j(below, &slow);
545 547
546 // Object case: Check key against length in the elements array. 548 // Object case: Check key against length in the elements array.
547 // Key is a smi. 549 // Key is a smi.
548 // edi: receiver map 550 // edi: receiver map
549 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); 551 __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset));
550 // Check array bounds. Both the key and the length of FixedArray are smis. 552 // Check array bounds. Both the key and the length of FixedArray are smis.
551 __ cmp(key, FieldOperand(ebx, FixedArray::kLengthOffset)); 553 __ cmp(key, FieldOperand(ebx, FixedArray::kLengthOffset));
552 __ j(below, &fast_object); 554 __ j(below, &fast_object);
553 555
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 Condition cc = 881 Condition cc =
880 (check == ENABLE_INLINED_SMI_CHECK) 882 (check == ENABLE_INLINED_SMI_CHECK)
881 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 883 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
882 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 884 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
883 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 885 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
884 } 886 }
885 } // namespace internal 887 } // namespace internal
886 } // namespace v8 888 } // namespace v8
887 889
888 #endif // V8_TARGET_ARCH_IA32 890 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ic/arm64/ic-arm64.cc ('k') | src/ic/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698