OLD | NEW |
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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
8 | 8 |
9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 __ pop(slot); | 76 __ pop(slot); |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 void PropertyHandlerCompiler::DiscardVectorAndSlot() { | 80 void PropertyHandlerCompiler::DiscardVectorAndSlot() { |
81 MacroAssembler* masm = this->masm(); | 81 MacroAssembler* masm = this->masm(); |
82 // Remove vector and slot. | 82 // Remove vector and slot. |
83 __ add(esp, Immediate(2 * kPointerSize)); | 83 __ add(esp, Immediate(2 * kPointerSize)); |
84 } | 84 } |
85 | 85 |
86 void PropertyHandlerCompiler::PushReturnAddress(Register tmp) { | |
87 MacroAssembler* masm = this->masm(); | |
88 __ push(tmp); | |
89 } | |
90 | |
91 void PropertyHandlerCompiler::PopReturnAddress(Register tmp) { | |
92 MacroAssembler* masm = this->masm(); | |
93 __ pop(tmp); | |
94 } | |
95 | |
96 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( | 86 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
97 MacroAssembler* masm, Label* miss_label, Register receiver, | 87 MacroAssembler* masm, Label* miss_label, Register receiver, |
98 Handle<Name> name, Register scratch0, Register scratch1) { | 88 Handle<Name> name, Register scratch0, Register scratch1) { |
99 DCHECK(name->IsUniqueName()); | 89 DCHECK(name->IsUniqueName()); |
100 DCHECK(!receiver.is(scratch0)); | 90 DCHECK(!receiver.is(scratch0)); |
101 Counters* counters = masm->isolate()->counters(); | 91 Counters* counters = masm->isolate()->counters(); |
102 __ IncrementCounter(counters->negative_lookups(), 1); | 92 __ IncrementCounter(counters->negative_lookups(), 1); |
103 __ IncrementCounter(counters->negative_lookups_miss(), 1); | 93 __ IncrementCounter(counters->negative_lookups_miss(), 1); |
104 | 94 |
105 __ mov(scratch0, FieldOperand(receiver, HeapObject::kMapOffset)); | 95 __ mov(scratch0, FieldOperand(receiver, HeapObject::kMapOffset)); |
(...skipping 19 matching lines...) Expand all Loading... |
125 Immediate(masm->isolate()->factory()->hash_table_map())); | 115 Immediate(masm->isolate()->factory()->hash_table_map())); |
126 __ j(not_equal, miss_label); | 116 __ j(not_equal, miss_label); |
127 | 117 |
128 Label done; | 118 Label done; |
129 NameDictionaryLookupStub::GenerateNegativeLookup(masm, miss_label, &done, | 119 NameDictionaryLookupStub::GenerateNegativeLookup(masm, miss_label, &done, |
130 properties, name, scratch1); | 120 properties, name, scratch1); |
131 __ bind(&done); | 121 __ bind(&done); |
132 __ DecrementCounter(counters->negative_lookups_miss(), 1); | 122 __ DecrementCounter(counters->negative_lookups_miss(), 1); |
133 } | 123 } |
134 | 124 |
135 | |
136 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( | |
137 MacroAssembler* masm, int index, Register result, Label* miss) { | |
138 __ LoadGlobalFunction(index, result); | |
139 // Load its initial map. The global functions all have initial maps. | |
140 __ mov(result, | |
141 FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); | |
142 // Load the prototype from the initial map. | |
143 __ mov(result, FieldOperand(result, Map::kPrototypeOffset)); | |
144 } | |
145 | |
146 | |
147 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 125 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
148 MacroAssembler* masm, Register receiver, Register scratch1, | 126 MacroAssembler* masm, Register receiver, Register scratch1, |
149 Register scratch2, Label* miss_label) { | 127 Register scratch2, Label* miss_label) { |
150 // TODO(mvstanton): This isn't used on ia32. Move all the other | 128 // TODO(mvstanton): This isn't used on ia32. Move all the other |
151 // platform implementations into a code stub so this method can be removed. | 129 // platform implementations into a code stub so this method can be removed. |
152 UNREACHABLE(); | 130 UNREACHABLE(); |
153 } | 131 } |
154 | 132 |
155 | 133 |
156 // Generate call to api function. | 134 // Generate call to api function. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 330 |
353 | 331 |
354 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 332 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
355 Handle<Name> name) { | 333 Handle<Name> name) { |
356 if (!label->is_unused()) { | 334 if (!label->is_unused()) { |
357 __ bind(label); | 335 __ bind(label); |
358 __ mov(this->name(), Immediate(name)); | 336 __ mov(this->name(), Immediate(name)); |
359 } | 337 } |
360 } | 338 } |
361 | 339 |
362 | |
363 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) { | |
364 __ mov(this->name(), Immediate(name)); | |
365 } | |
366 | |
367 | |
368 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, | |
369 Register map_reg, | |
370 Register scratch, | |
371 Label* miss) { | |
372 Handle<WeakCell> cell = Map::WeakCellForMap(transition); | |
373 DCHECK(!map_reg.is(scratch)); | |
374 __ LoadWeakValue(map_reg, cell, miss); | |
375 if (transition->CanBeDeprecated()) { | |
376 __ mov(scratch, FieldOperand(map_reg, Map::kBitField3Offset)); | |
377 __ and_(scratch, Immediate(Map::Deprecated::kMask)); | |
378 __ j(not_zero, miss); | |
379 } | |
380 } | |
381 | |
382 | |
383 void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, | |
384 int descriptor, | |
385 Register value_reg, | |
386 Register scratch, | |
387 Label* miss_label) { | |
388 DCHECK(!map_reg.is(scratch)); | |
389 DCHECK(!map_reg.is(value_reg)); | |
390 DCHECK(!value_reg.is(scratch)); | |
391 __ LoadInstanceDescriptors(map_reg, scratch); | |
392 __ mov(scratch, | |
393 FieldOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); | |
394 __ cmp(value_reg, scratch); | |
395 __ j(not_equal, miss_label); | |
396 } | |
397 | |
398 void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(FieldType* field_type, | |
399 Register value_reg, | |
400 Label* miss_label) { | |
401 Register map_reg = scratch1(); | |
402 Register scratch = scratch2(); | |
403 DCHECK(!value_reg.is(map_reg)); | |
404 DCHECK(!value_reg.is(scratch)); | |
405 __ JumpIfSmi(value_reg, miss_label); | |
406 if (field_type->IsClass()) { | |
407 __ mov(map_reg, FieldOperand(value_reg, HeapObject::kMapOffset)); | |
408 __ CmpWeakValue(map_reg, Map::WeakCellForMap(field_type->AsClass()), | |
409 scratch); | |
410 __ j(not_equal, miss_label); | |
411 } | |
412 } | |
413 | |
414 void PropertyHandlerCompiler::GenerateAccessCheck( | 340 void PropertyHandlerCompiler::GenerateAccessCheck( |
415 Handle<WeakCell> native_context_cell, Register scratch1, Register scratch2, | 341 Handle<WeakCell> native_context_cell, Register scratch1, Register scratch2, |
416 Label* miss, bool compare_native_contexts_only) { | 342 Label* miss, bool compare_native_contexts_only) { |
417 Label done; | 343 Label done; |
418 // Load current native context. | 344 // Load current native context. |
419 __ mov(scratch1, NativeContextOperand()); | 345 __ mov(scratch1, NativeContextOperand()); |
420 // Load expected native context. | 346 // Load expected native context. |
421 __ LoadWeakValue(scratch2, native_context_cell, miss); | 347 __ LoadWeakValue(scratch2, native_context_cell, miss); |
422 __ cmp(scratch1, scratch2); | 348 __ cmp(scratch1, scratch2); |
423 | 349 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 if (!miss->is_unused()) { | 459 if (!miss->is_unused()) { |
534 Label success; | 460 Label success; |
535 __ jmp(&success); | 461 __ jmp(&success); |
536 GenerateRestoreName(miss, name); | 462 GenerateRestoreName(miss, name); |
537 DCHECK(!IC::ShouldPushPopSlotAndVector(kind())); | 463 DCHECK(!IC::ShouldPushPopSlotAndVector(kind())); |
538 TailCallBuiltin(masm(), MissBuiltin(kind())); | 464 TailCallBuiltin(masm(), MissBuiltin(kind())); |
539 __ bind(&success); | 465 __ bind(&success); |
540 } | 466 } |
541 } | 467 } |
542 | 468 |
543 | |
544 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | |
545 // Return the constant value. | |
546 __ LoadObject(eax, value); | |
547 __ ret(0); | |
548 } | |
549 | |
550 | |
551 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 469 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
552 LookupIterator* it, Register holder_reg) { | 470 LookupIterator* it, Register holder_reg) { |
553 DCHECK(holder()->HasNamedInterceptor()); | 471 DCHECK(holder()->HasNamedInterceptor()); |
554 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); | 472 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
555 | 473 |
556 // Compile the interceptor call, followed by inline code to load the | 474 // Compile the interceptor call, followed by inline code to load the |
557 // property from further up the prototype chain if the call fails. | 475 // property from further up the prototype chain if the call fails. |
558 // Check that the maps haven't changed. | 476 // Check that the maps haven't changed. |
559 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 477 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
560 | 478 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 // Return the generated code. | 629 // Return the generated code. |
712 return GetCode(kind(), name); | 630 return GetCode(kind(), name); |
713 } | 631 } |
714 | 632 |
715 | 633 |
716 #undef __ | 634 #undef __ |
717 } // namespace internal | 635 } // namespace internal |
718 } // namespace v8 | 636 } // namespace v8 |
719 | 637 |
720 #endif // V8_TARGET_ARCH_IA32 | 638 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |