OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 generating_stub_(false), | 47 generating_stub_(false), |
48 allow_stub_calls_(true), | 48 allow_stub_calls_(true), |
49 has_frame_(false) { | 49 has_frame_(false) { |
50 if (isolate() != NULL) { | 50 if (isolate() != NULL) { |
51 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), | 51 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), |
52 isolate()); | 52 isolate()); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 | 56 |
57 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { | |
58 if (isolate()->heap()->RootCanBeTreatedAsConstant(index)) { | |
59 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); | |
60 mov(destination, value); | |
61 return; | |
62 } | |
63 ExternalReference roots_array_start = | |
64 ExternalReference::roots_array_start(isolate()); | |
65 mov(destination, Immediate(index)); | |
66 mov(destination, Operand::StaticArray(destination, | |
67 times_pointer_size, | |
68 roots_array_start)); | |
danno
2013/08/09 13:36:03
The two moves all be done in one instruction, you
Benedikt Meurer
2013/08/09 13:41:55
There's no way to do this in one instruction, caus
| |
69 } | |
70 | |
71 | |
72 void MacroAssembler::StoreRoot(Register source, | |
73 Register scratch, | |
74 Heap::RootListIndex index) { | |
75 ASSERT(Heap::RootCanBeWrittenAfterInitialization(index)); | |
76 ExternalReference roots_array_start = | |
77 ExternalReference::roots_array_start(isolate()); | |
78 mov(scratch, Immediate(index)); | |
79 mov(Operand::StaticArray(scratch, times_pointer_size, roots_array_start), | |
80 source); | |
81 } | |
82 | |
83 | |
84 void MacroAssembler::CompareRoot(Register with, | |
85 Register scratch, | |
86 Heap::RootListIndex index) { | |
87 ExternalReference roots_array_start = | |
88 ExternalReference::roots_array_start(isolate()); | |
89 mov(scratch, Immediate(index)); | |
90 cmp(with, Operand::StaticArray(scratch, | |
91 times_pointer_size, | |
92 roots_array_start)); | |
93 } | |
94 | |
95 | |
96 void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) { | |
97 ASSERT(isolate()->heap()->RootCanBeTreatedAsConstant(index)); | |
98 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); | |
99 cmp(with, value); | |
100 } | |
101 | |
102 | |
103 void MacroAssembler::CompareRoot(const Operand& with, | |
104 Heap::RootListIndex index) { | |
105 ASSERT(isolate()->heap()->RootCanBeTreatedAsConstant(index)); | |
106 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); | |
107 cmp(with, value); | |
108 } | |
109 | |
110 | |
57 void MacroAssembler::InNewSpace( | 111 void MacroAssembler::InNewSpace( |
58 Register object, | 112 Register object, |
59 Register scratch, | 113 Register scratch, |
60 Condition cc, | 114 Condition cc, |
61 Label* condition_met, | 115 Label* condition_met, |
62 Label::Distance condition_met_distance) { | 116 Label::Distance condition_met_distance) { |
63 ASSERT(cc == equal || cc == not_equal); | 117 ASSERT(cc == equal || cc == not_equal); |
64 if (scratch.is(object)) { | 118 if (scratch.is(object)) { |
65 and_(scratch, Immediate(~Page::kPageAlignmentMask)); | 119 and_(scratch, Immediate(~Page::kPageAlignmentMask)); |
66 } else { | 120 } else { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 void MacroAssembler::SafePush(const Immediate& x) { | 479 void MacroAssembler::SafePush(const Immediate& x) { |
426 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { | 480 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { |
427 push(Immediate(x.x_ ^ jit_cookie())); | 481 push(Immediate(x.x_ ^ jit_cookie())); |
428 xor_(Operand(esp, 0), Immediate(jit_cookie())); | 482 xor_(Operand(esp, 0), Immediate(jit_cookie())); |
429 } else { | 483 } else { |
430 push(x); | 484 push(x); |
431 } | 485 } |
432 } | 486 } |
433 | 487 |
434 | 488 |
435 void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) { | |
436 // see ROOT_ACCESSOR macro in factory.h | |
437 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); | |
438 cmp(with, value); | |
439 } | |
440 | |
441 | |
442 void MacroAssembler::CompareRoot(const Operand& with, | |
443 Heap::RootListIndex index) { | |
444 // see ROOT_ACCESSOR macro in factory.h | |
445 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); | |
446 cmp(with, value); | |
447 } | |
448 | |
449 | |
450 void MacroAssembler::CmpObjectType(Register heap_object, | 489 void MacroAssembler::CmpObjectType(Register heap_object, |
451 InstanceType type, | 490 InstanceType type, |
452 Register map) { | 491 Register map) { |
453 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); | 492 mov(map, FieldOperand(heap_object, HeapObject::kMapOffset)); |
454 CmpInstanceType(map, type); | 493 CmpInstanceType(map, type); |
455 } | 494 } |
456 | 495 |
457 | 496 |
458 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { | 497 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { |
459 cmpb(FieldOperand(map, Map::kInstanceTypeOffset), | 498 cmpb(FieldOperand(map, Map::kInstanceTypeOffset), |
(...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3187 j(greater, &no_memento_available); | 3226 j(greater, &no_memento_available); |
3188 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), | 3227 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), |
3189 Immediate(Handle<Map>(isolate()->heap()->allocation_memento_map()))); | 3228 Immediate(Handle<Map>(isolate()->heap()->allocation_memento_map()))); |
3190 bind(&no_memento_available); | 3229 bind(&no_memento_available); |
3191 } | 3230 } |
3192 | 3231 |
3193 | 3232 |
3194 } } // namespace v8::internal | 3233 } } // namespace v8::internal |
3195 | 3234 |
3196 #endif // V8_TARGET_ARCH_IA32 | 3235 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |