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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 namespace v8 { | 40 namespace v8 { |
41 namespace internal { | 41 namespace internal { |
42 | 42 |
43 // ------------------------------------------------------------------------- | 43 // ------------------------------------------------------------------------- |
44 // MacroAssembler implementation. | 44 // MacroAssembler implementation. |
45 | 45 |
46 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 46 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
47 : Assembler(arg_isolate, buffer, size), | 47 : Assembler(arg_isolate, buffer, size), |
48 generating_stub_(false), | 48 generating_stub_(false), |
49 allow_stub_calls_(true), | |
50 has_frame_(false) { | 49 has_frame_(false) { |
51 if (isolate() != NULL) { | 50 if (isolate() != NULL) { |
52 // TODO(titzer): should we just use a null handle here instead? | 51 // TODO(titzer): should we just use a null handle here instead? |
53 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), | 52 code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), |
54 isolate()); | 53 isolate()); |
55 } | 54 } |
56 } | 55 } |
57 | 56 |
58 | 57 |
59 void MacroAssembler::Load(Register dst, const Operand& src, Representation r) { | 58 void MacroAssembler::Load(Register dst, const Operand& src, Representation r) { |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 } | 2180 } |
2182 | 2181 |
2183 | 2182 |
2184 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id) { | 2183 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id) { |
2185 ASSERT(AllowThisStubCall(stub)); // Calls are not allowed in some stubs. | 2184 ASSERT(AllowThisStubCall(stub)); // Calls are not allowed in some stubs. |
2186 call(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id); | 2185 call(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id); |
2187 } | 2186 } |
2188 | 2187 |
2189 | 2188 |
2190 void MacroAssembler::TailCallStub(CodeStub* stub) { | 2189 void MacroAssembler::TailCallStub(CodeStub* stub) { |
2191 ASSERT(allow_stub_calls_ || | |
2192 stub->CompilingCallsToThisStubIsGCSafe(isolate())); | |
2193 jmp(stub->GetCode(isolate()), RelocInfo::CODE_TARGET); | 2190 jmp(stub->GetCode(isolate()), RelocInfo::CODE_TARGET); |
2194 } | 2191 } |
2195 | 2192 |
2196 | 2193 |
2197 void MacroAssembler::StubReturn(int argc) { | 2194 void MacroAssembler::StubReturn(int argc) { |
2198 ASSERT(argc >= 1 && generating_stub()); | 2195 ASSERT(argc >= 1 && generating_stub()); |
2199 ret((argc - 1) * kPointerSize); | 2196 ret((argc - 1) * kPointerSize); |
2200 } | 2197 } |
2201 | 2198 |
2202 | 2199 |
2203 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { | 2200 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { |
2204 if (!has_frame_ && stub->SometimesSetsUpAFrame()) return false; | 2201 return has_frame_ || !stub->SometimesSetsUpAFrame(); |
2205 return allow_stub_calls_ || stub->CompilingCallsToThisStubIsGCSafe(isolate()); | |
2206 } | 2202 } |
2207 | 2203 |
2208 | 2204 |
2209 void MacroAssembler::IllegalOperation(int num_arguments) { | 2205 void MacroAssembler::IllegalOperation(int num_arguments) { |
2210 if (num_arguments > 0) { | 2206 if (num_arguments > 0) { |
2211 add(esp, Immediate(num_arguments * kPointerSize)); | 2207 add(esp, Immediate(num_arguments * kPointerSize)); |
2212 } | 2208 } |
2213 mov(eax, Immediate(isolate()->factory()->undefined_value())); | 2209 mov(eax, Immediate(isolate()->factory()->undefined_value())); |
2214 } | 2210 } |
2215 | 2211 |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3691 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3687 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
3692 j(equal, found); | 3688 j(equal, found); |
3693 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3689 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
3694 cmp(current, Immediate(factory->null_value())); | 3690 cmp(current, Immediate(factory->null_value())); |
3695 j(not_equal, &loop_again); | 3691 j(not_equal, &loop_again); |
3696 } | 3692 } |
3697 | 3693 |
3698 } } // namespace v8::internal | 3694 } } // namespace v8::internal |
3699 | 3695 |
3700 #endif // V8_TARGET_ARCH_IA32 | 3696 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |