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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 136643008: A64: Synchronize with r18256. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-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 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
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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); 1099 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize);
1101 push(ebp); 1100 push(ebp);
1102 mov(ebp, esp); 1101 mov(ebp, esp);
1103 1102
1104 // Reserve room for entry stack pointer and push the code object. 1103 // Reserve room for entry stack pointer and push the code object.
1105 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); 1104 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize);
1106 push(Immediate(0)); // Saved entry sp, patched before call. 1105 push(Immediate(0)); // Saved entry sp, patched before call.
1107 push(Immediate(CodeObject())); // Accessed from ExitFrame::code_slot. 1106 push(Immediate(CodeObject())); // Accessed from ExitFrame::code_slot.
1108 1107
1109 // Save the frame pointer and the context in top. 1108 // Save the frame pointer and the context in top.
1110 ExternalReference c_entry_fp_address(Isolate::kCEntryFPAddress, 1109 ExternalReference c_entry_fp_address(Isolate::kCEntryFPAddress, isolate());
1111 isolate()); 1110 ExternalReference context_address(Isolate::kContextAddress, isolate());
1112 ExternalReference context_address(Isolate::kContextAddress,
1113 isolate());
1114 mov(Operand::StaticVariable(c_entry_fp_address), ebp); 1111 mov(Operand::StaticVariable(c_entry_fp_address), ebp);
1115 mov(Operand::StaticVariable(context_address), esi); 1112 mov(Operand::StaticVariable(context_address), esi);
1116 } 1113 }
1117 1114
1118 1115
1119 void MacroAssembler::EnterExitFrameEpilogue(int argc, bool save_doubles) { 1116 void MacroAssembler::EnterExitFrameEpilogue(int argc, bool save_doubles) {
1120 // Optionally save all XMM registers. 1117 // Optionally save all XMM registers.
1121 if (save_doubles) { 1118 if (save_doubles) {
1122 CpuFeatureScope scope(this, SSE2); 1119 CpuFeatureScope scope(this, SSE2);
1123 int space = XMMRegister::kNumRegisters * kDoubleSize + argc * kPointerSize; 1120 int space = XMMRegister::kNumRegisters * kDoubleSize + argc * kPointerSize;
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 } 2180 }
2184 2181
2185 2182
2186 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id) { 2183 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id) {
2187 ASSERT(AllowThisStubCall(stub)); // Calls are not allowed in some stubs. 2184 ASSERT(AllowThisStubCall(stub)); // Calls are not allowed in some stubs.
2188 call(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id); 2185 call(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id);
2189 } 2186 }
2190 2187
2191 2188
2192 void MacroAssembler::TailCallStub(CodeStub* stub) { 2189 void MacroAssembler::TailCallStub(CodeStub* stub) {
2193 ASSERT(allow_stub_calls_ ||
2194 stub->CompilingCallsToThisStubIsGCSafe(isolate()));
2195 jmp(stub->GetCode(isolate()), RelocInfo::CODE_TARGET); 2190 jmp(stub->GetCode(isolate()), RelocInfo::CODE_TARGET);
2196 } 2191 }
2197 2192
2198 2193
2199 void MacroAssembler::StubReturn(int argc) { 2194 void MacroAssembler::StubReturn(int argc) {
2200 ASSERT(argc >= 1 && generating_stub()); 2195 ASSERT(argc >= 1 && generating_stub());
2201 ret((argc - 1) * kPointerSize); 2196 ret((argc - 1) * kPointerSize);
2202 } 2197 }
2203 2198
2204 2199
2205 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { 2200 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) {
2206 if (!has_frame_ && stub->SometimesSetsUpAFrame()) return false; 2201 return has_frame_ || !stub->SometimesSetsUpAFrame();
2207 return allow_stub_calls_ || stub->CompilingCallsToThisStubIsGCSafe(isolate());
2208 } 2202 }
2209 2203
2210 2204
2211 void MacroAssembler::IllegalOperation(int num_arguments) { 2205 void MacroAssembler::IllegalOperation(int num_arguments) {
2212 if (num_arguments > 0) { 2206 if (num_arguments > 0) {
2213 add(esp, Immediate(num_arguments * kPointerSize)); 2207 add(esp, Immediate(num_arguments * kPointerSize));
2214 } 2208 }
2215 mov(eax, Immediate(isolate()->factory()->undefined_value())); 2209 mov(eax, Immediate(isolate()->factory()->undefined_value()));
2216 } 2210 }
2217 2211
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2629 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 2623 mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
2630 mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); 2624 mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset));
2631 SmiUntag(ebx); 2625 SmiUntag(ebx);
2632 2626
2633 ParameterCount expected(ebx); 2627 ParameterCount expected(ebx);
2634 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), 2628 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
2635 expected, actual, flag, call_wrapper, call_kind); 2629 expected, actual, flag, call_wrapper, call_kind);
2636 } 2630 }
2637 2631
2638 2632
2639 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, 2633 void MacroAssembler::InvokeFunction(Register fun,
2640 const ParameterCount& expected, 2634 const ParameterCount& expected,
2641 const ParameterCount& actual, 2635 const ParameterCount& actual,
2642 InvokeFlag flag, 2636 InvokeFlag flag,
2643 const CallWrapper& call_wrapper, 2637 const CallWrapper& call_wrapper,
2644 CallKind call_kind) { 2638 CallKind call_kind) {
2645 // You can't call a function without a valid frame. 2639 // You can't call a function without a valid frame.
2646 ASSERT(flag == JUMP_FUNCTION || has_frame()); 2640 ASSERT(flag == JUMP_FUNCTION || has_frame());
2647 2641
2648 // Get the function and setup the context. 2642 ASSERT(fun.is(edi));
2649 LoadHeapObject(edi, function);
2650 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 2643 mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
2651 2644
2652 // We call indirectly through the code field in the function to
2653 // allow recompilation to take effect without changing any of the
2654 // call sites.
2655 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), 2645 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
2656 expected, actual, flag, call_wrapper, call_kind); 2646 expected, actual, flag, call_wrapper, call_kind);
2657 } 2647 }
2658 2648
2659 2649
2650 void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
2651 const ParameterCount& expected,
2652 const ParameterCount& actual,
2653 InvokeFlag flag,
2654 const CallWrapper& call_wrapper,
2655 CallKind call_kind) {
2656 LoadHeapObject(edi, function);
2657 InvokeFunction(edi, expected, actual, flag, call_wrapper, call_kind);
2658 }
2659
2660
2660 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, 2661 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
2661 InvokeFlag flag, 2662 InvokeFlag flag,
2662 const CallWrapper& call_wrapper) { 2663 const CallWrapper& call_wrapper) {
2663 // You can't call a builtin without a valid frame. 2664 // You can't call a builtin without a valid frame.
2664 ASSERT(flag == JUMP_FUNCTION || has_frame()); 2665 ASSERT(flag == JUMP_FUNCTION || has_frame());
2665 2666
2666 // Rely on the assertion to check that the number of provided 2667 // Rely on the assertion to check that the number of provided
2667 // arguments match the expected number of arguments. Fake a 2668 // arguments match the expected number of arguments. Fake a
2668 // parameter count to avoid emitting code to do the check. 2669 // parameter count to avoid emitting code to do the check.
2669 ParameterCount expected(0); 2670 ParameterCount expected(0);
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
3693 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); 3694 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS));
3694 j(equal, found); 3695 j(equal, found);
3695 mov(current, FieldOperand(current, Map::kPrototypeOffset)); 3696 mov(current, FieldOperand(current, Map::kPrototypeOffset));
3696 cmp(current, Immediate(factory->null_value())); 3697 cmp(current, Immediate(factory->null_value()));
3697 j(not_equal, &loop_again); 3698 j(not_equal, &loop_again);
3698 } 3699 }
3699 3700
3700 } } // namespace v8::internal 3701 } } // namespace v8::internal
3701 3702
3702 #endif // V8_TARGET_ARCH_IA32 3703 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698