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

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

Issue 958283002: X87: 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 | « no previous file | src/ic/x87/ic-compiler-x87.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_X87 7 #if V8_TARGET_ARCH_X87
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 // Swap in the global receiver.
259 __ mov(scratch, 256 __ mov(scratch,
260 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); 257 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
261 receiver = scratch; 258 receiver = scratch;
262 } 259 }
263 __ push(receiver); 260 __ push(receiver);
264 __ push(value()); 261 __ push(value());
265 ParameterCount actual(1); 262 ParameterCount actual(1);
266 ParameterCount expected(expected_arguments); 263 ParameterCount expected(expected_arguments);
267 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER); 264 __ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER);
268 __ 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
412 } 409 }
413 __ bind(&do_store); 410 __ bind(&do_store);
414 } 411 }
415 } 412 }
416 413
417 414
418 Register PropertyHandlerCompiler::CheckPrototypes( 415 Register PropertyHandlerCompiler::CheckPrototypes(
419 Register object_reg, Register holder_reg, Register scratch1, 416 Register object_reg, Register holder_reg, Register scratch1,
420 Register scratch2, Handle<Name> name, Label* miss, 417 Register scratch2, Handle<Name> name, Label* miss,
421 PrototypeCheckType check) { 418 PrototypeCheckType check) {
422 Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate())); 419 Handle<Map> receiver_map = map();
423 420
424 // Make sure there's no overlap between holder and object registers. 421 // Make sure there's no overlap between holder and object registers.
425 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); 422 DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
426 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) && 423 DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) &&
427 !scratch2.is(scratch1)); 424 !scratch2.is(scratch1));
428 425
429 // Keep track of the current object in register reg. 426 // Keep track of the current object in register reg.
430 Register reg = object_reg; 427 Register reg = object_reg;
431 int depth = 0; 428 int depth = 0;
432 429
433 Handle<JSObject> current = Handle<JSObject>::null(); 430 Handle<JSObject> current = Handle<JSObject>::null();
434 if (type()->IsConstant()) 431 if (receiver_map->IsJSGlobalObjectMap()) {
435 current = Handle<JSObject>::cast(type()->AsConstant()->Value()); 432 current = isolate()->global_object();
433 }
436 Handle<JSObject> prototype = Handle<JSObject>::null(); 434 Handle<JSObject> prototype = Handle<JSObject>::null();
437 Handle<Map> current_map = receiver_map; 435 Handle<Map> current_map = receiver_map;
438 Handle<Map> holder_map(holder()->map()); 436 Handle<Map> holder_map(holder()->map());
439 // 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
440 // fast and global objects or do negative lookup for normal objects. 438 // fast and global objects or do negative lookup for normal objects.
441 while (!current_map.is_identical_to(holder_map)) { 439 while (!current_map.is_identical_to(holder_map)) {
442 ++depth; 440 ++depth;
443 441
444 // Only global objects and objects that do not require access 442 // Only global objects and objects that do not require access
445 // checks are allowed in stubs. 443 // checks are allowed in stubs.
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 // Return the generated code. 772 // Return the generated code.
775 return GetCode(kind(), Code::NORMAL, name); 773 return GetCode(kind(), Code::NORMAL, name);
776 } 774 }
777 775
778 776
779 #undef __ 777 #undef __
780 } 778 }
781 } // namespace v8::internal 779 } // namespace v8::internal
782 780
783 #endif // V8_TARGET_ARCH_X87 781 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | src/ic/x87/ic-compiler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698