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

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

Issue 935603002: Stop using HeapType in IC and Crankshaft (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/ic/ia32/ic-compiler-ia32.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ic/call-optimization.h" 9 #include "src/ic/call-optimization.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
11 #include "src/ic/ic.h" 11 #include "src/ic/ic.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 #define __ ACCESS_MASM(masm) 16 #define __ ACCESS_MASM(masm)
17 17
18 18
19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( 19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
20 MacroAssembler* masm, Handle<HeapType> type, Register receiver, 20 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder,
21 Register holder, int accessor_index, int expected_arguments, 21 int accessor_index, int expected_arguments, Register scratch) {
22 Register scratch) {
23 { 22 {
24 FrameScope scope(masm, StackFrame::INTERNAL); 23 FrameScope scope(masm, StackFrame::INTERNAL);
25 24
26 if (accessor_index >= 0) { 25 if (accessor_index >= 0) {
27 DCHECK(!holder.is(scratch)); 26 DCHECK(!holder.is(scratch));
28 DCHECK(!receiver.is(scratch)); 27 DCHECK(!receiver.is(scratch));
29 // Call the JavaScript getter with the receiver on the stack. 28 // Call the JavaScript getter with the receiver on the stack.
30 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { 29 if (map->IsJSGlobalObjectMap()) {
31 // Swap in the global receiver. 30 // Swap in the global receiver.
32 __ mov(scratch, 31 __ mov(scratch,
33 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); 32 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
34 receiver = scratch; 33 receiver = scratch;
35 } 34 }
36 __ push(receiver); 35 __ push(receiver);
37 ParameterCount actual(0); 36 ParameterCount actual(0);
38 ParameterCount expected(expected_arguments); 37 ParameterCount expected(expected_arguments);
39 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_GETTER); 38 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_GETTER);
40 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, 39 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 Factory* factory = masm->isolate()->factory(); 229 Factory* factory = masm->isolate()->factory();
231 Handle<WeakCell> weak_cell = factory->NewWeakCell(cell); 230 Handle<WeakCell> weak_cell = factory->NewWeakCell(cell);
232 __ LoadWeakValue(scratch, weak_cell, miss); 231 __ LoadWeakValue(scratch, weak_cell, miss);
233 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset), 232 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset),
234 Immediate(factory->the_hole_value())); 233 Immediate(factory->the_hole_value()));
235 __ j(not_equal, miss); 234 __ j(not_equal, miss);
236 } 235 }
237 236
238 237
239 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( 238 void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
240 MacroAssembler* masm, Handle<HeapType> type, Register receiver, 239 MacroAssembler* masm, Handle<Map> map, Register receiver, Register holder,
241 Register holder, int accessor_index, int expected_arguments, 240 int accessor_index, int expected_arguments, Register scratch) {
242 Register scratch) {
243 // ----------- S t a t e ------------- 241 // ----------- S t a t e -------------
244 // -- esp[0] : return address 242 // -- esp[0] : return address
245 // ----------------------------------- 243 // -----------------------------------
246 { 244 {
247 FrameScope scope(masm, StackFrame::INTERNAL); 245 FrameScope scope(masm, StackFrame::INTERNAL);
248 246
249 // Save value register, so we can restore it later. 247 // Save value register, so we can restore it later.
250 __ push(value()); 248 __ push(value());
251 249
252 if (accessor_index >= 0) { 250 if (accessor_index >= 0) {
253 DCHECK(!holder.is(scratch)); 251 DCHECK(!holder.is(scratch));
254 DCHECK(!receiver.is(scratch)); 252 DCHECK(!receiver.is(scratch));
255 DCHECK(!value().is(scratch)); 253 DCHECK(!value().is(scratch));
256 // Call the JavaScript setter with receiver and value on the stack. 254 // Call the JavaScript setter with receiver and value on the stack.
257 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { 255 if (map->IsJSGlobalObjectMap()) {
258 __ mov(scratch, 256 __ mov(scratch,
259 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); 257 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
260 receiver = scratch; 258 receiver = scratch;
261 } 259 }
262 __ push(receiver); 260 __ push(receiver);
263 __ push(value()); 261 __ push(value());
264 ParameterCount actual(1); 262 ParameterCount actual(1);
265 ParameterCount expected(expected_arguments); 263 ParameterCount expected(expected_arguments);
266 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER); 264 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER);
267 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, 265 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 409 }
412 __ bind(&do_store); 410 __ bind(&do_store);
413 } 411 }
414 } 412 }
415 413
416 414
417 Register PropertyHandlerCompiler::CheckPrototypes( 415 Register PropertyHandlerCompiler::CheckPrototypes(
418 Register object_reg, Register holder_reg, Register scratch1, 416 Register object_reg, Register holder_reg, Register scratch1,
419 Register scratch2, Handle<Name> name, Label* miss, 417 Register scratch2, Handle<Name> name, Label* miss,
420 PrototypeCheckType check) { 418 PrototypeCheckType check) {
421 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); 419 Handle<Map> receiver_map = map();
422 420
423 // Make sure there's no overlap between holder and object registers. 421 // Make sure there's no overlap between holder and object registers.
424 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); 422 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
425 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && 423 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) &&
426 !scratch2.is(scratch1)); 424 !scratch2.is(scratch1));
427 425
428 // Keep track of the current object in register reg. 426 // Keep track of the current object in register reg.
429 Register reg = object_reg; 427 Register reg = object_reg;
430 int depth = 0; 428 int depth = 0;
431 429
432 Handle<JSObject> current = Handle<JSObject>::null(); 430 Handle<JSObject> current = Handle<JSObject>::null();
433 if (type()->IsConstant()) 431 if (receiver_map->IsJSGlobalObjectMap()) {
434 current = Handle<JSObject>::cast(type()->AsConstant()->Value()); 432 current = isolate()->global_object();
433 }
435 Handle<JSObject> prototype = Handle<JSObject>::null(); 434 Handle<JSObject> prototype = Handle<JSObject>::null();
436 Handle<Map> current_map = receiver_map; 435 Handle<Map> current_map = receiver_map;
437 Handle<Map> holder_map(holder()->map()); 436 Handle<Map> holder_map(holder()->map());
438 // Traverse the prototype chain and check the maps in the prototype chain for 437 // Traverse the prototype chain and check the maps in the prototype chain for
439 // fast and global objects or do negative lookup for normal objects. 438 // fast and global objects or do negative lookup for normal objects.
440 while (!current_map.is_identical_to(holder_map)) { 439 while (!current_map.is_identical_to(holder_map)) {
441 ++depth; 440 ++depth;
442 441
443 // Only global objects and objects that do not require access 442 // Only global objects and objects that do not require access
444 // checks are allowed in stubs. 443 // checks are allowed in stubs.
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 // Return the generated code. 764 // Return the generated code.
766 return GetCode(kind(), Code::NORMAL, name); 765 return GetCode(kind(), Code::NORMAL, name);
767 } 766 }
768 767
769 768
770 #undef __ 769 #undef __
771 } 770 }
772 } // namespace v8::internal 771 } // namespace v8::internal
773 772
774 #endif // V8_TARGET_ARCH_IA32 773 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/ic/ia32/ic-compiler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698