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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 190793002: Introduce FrameAndConstantPoolScope and ConstantPoolUnavailableScope. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Sync Created 6 years, 9 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/arm/builtins-arm.cc ('k') | src/arm/debug-arm.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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { 484 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) {
485 // Update the static counter each time a new code stub is generated. 485 // Update the static counter each time a new code stub is generated.
486 Isolate* isolate = masm->isolate(); 486 Isolate* isolate = masm->isolate();
487 isolate->counters()->code_stubs()->Increment(); 487 isolate->counters()->code_stubs()->Increment();
488 488
489 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate); 489 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate);
490 int param_count = descriptor->register_param_count_; 490 int param_count = descriptor->register_param_count_;
491 { 491 {
492 // Call the runtime system in a fresh internal frame. 492 // Call the runtime system in a fresh internal frame.
493 FrameScope scope(masm, StackFrame::INTERNAL); 493 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
494 ASSERT(descriptor->register_param_count_ == 0 || 494 ASSERT(descriptor->register_param_count_ == 0 ||
495 r0.is(descriptor->register_params_[param_count - 1])); 495 r0.is(descriptor->register_params_[param_count - 1]));
496 // Push arguments 496 // Push arguments
497 for (int i = 0; i < param_count; ++i) { 497 for (int i = 0; i < param_count; ++i) {
498 __ push(descriptor->register_params_[i]); 498 __ push(descriptor->register_params_[i]);
499 } 499 }
500 ExternalReference miss = descriptor->miss_handler(); 500 ExternalReference miss = descriptor->miss_handler();
501 __ CallExternalReference(miss, descriptor->register_param_count_); 501 __ CallExternalReference(miss, descriptor->register_param_count_);
502 } 502 }
503 503
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 1599
1600 // Retrieve the pending exception. 1600 // Retrieve the pending exception.
1601 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, 1601 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
1602 isolate))); 1602 isolate)));
1603 __ ldr(r0, MemOperand(ip)); 1603 __ ldr(r0, MemOperand(ip));
1604 1604
1605 // See if we just retrieved an OOM exception. 1605 // See if we just retrieved an OOM exception.
1606 JumpIfOOM(masm, r0, ip, throw_out_of_memory_exception); 1606 JumpIfOOM(masm, r0, ip, throw_out_of_memory_exception);
1607 1607
1608 // Clear the pending exception. 1608 // Clear the pending exception.
1609 __ mov(r3, Operand(isolate->factory()->the_hole_value())); 1609 __ LoadRoot(r3, Heap::kTheHoleValueRootIndex);
1610 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, 1610 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
1611 isolate))); 1611 isolate)));
1612 __ str(r3, MemOperand(ip)); 1612 __ str(r3, MemOperand(ip));
1613 1613
1614 // Special handling of termination exceptions which are uncatchable 1614 // Special handling of termination exceptions which are uncatchable
1615 // by javascript code. 1615 // by javascript code.
1616 __ cmp(r0, Operand(isolate->factory()->termination_exception())); 1616 __ LoadRoot(r3, Heap::kTerminationExceptionRootIndex);
1617 __ cmp(r0, r3);
1617 __ b(eq, throw_termination_exception); 1618 __ b(eq, throw_termination_exception);
1618 1619
1619 // Handle normal exception. 1620 // Handle normal exception.
1620 __ jmp(throw_normal_exception); 1621 __ jmp(throw_normal_exception);
1621 1622
1622 __ bind(&retry); // pass last failure (r0) as parameter (r0) when retrying 1623 __ bind(&retry); // pass last failure (r0) as parameter (r0) when retrying
1623 } 1624 }
1624 1625
1625 1626
1626 void CEntryStub::Generate(MacroAssembler* masm) { 1627 void CEntryStub::Generate(MacroAssembler* masm) {
(...skipping 11 matching lines...) Expand all
1638 // NOTE: Invocations of builtins may return failure objects 1639 // NOTE: Invocations of builtins may return failure objects
1639 // instead of a proper result. The builtin entry handles 1640 // instead of a proper result. The builtin entry handles
1640 // this by performing a garbage collection and retrying the 1641 // this by performing a garbage collection and retrying the
1641 // builtin once. 1642 // builtin once.
1642 1643
1643 // Compute the argv pointer in a callee-saved register. 1644 // Compute the argv pointer in a callee-saved register.
1644 __ add(r6, sp, Operand(r0, LSL, kPointerSizeLog2)); 1645 __ add(r6, sp, Operand(r0, LSL, kPointerSizeLog2));
1645 __ sub(r6, r6, Operand(kPointerSize)); 1646 __ sub(r6, r6, Operand(kPointerSize));
1646 1647
1647 // Enter the exit frame that transitions from JavaScript to C++. 1648 // Enter the exit frame that transitions from JavaScript to C++.
1648 FrameScope scope(masm, StackFrame::MANUAL); 1649 FrameAndConstantPoolScope scope(masm, StackFrame::MANUAL);
1649 __ EnterExitFrame(save_doubles_); 1650 __ EnterExitFrame(save_doubles_);
1650 1651
1651 // Set up argc and the builtin function in callee-saved registers. 1652 // Set up argc and the builtin function in callee-saved registers.
1652 __ mov(r4, Operand(r0)); 1653 __ mov(r4, Operand(r0));
1653 __ mov(r5, Operand(r1)); 1654 __ mov(r5, Operand(r1));
1654 1655
1655 // r4: number of arguments (C callee-saved) 1656 // r4: number of arguments (C callee-saved)
1656 // r5: pointer to builtin function (C callee-saved) 1657 // r5: pointer to builtin function (C callee-saved)
1657 // r6: pointer to first argument (C callee-saved) 1658 // r6: pointer to first argument (C callee-saved)
1658 1659
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 2051
2051 // Slow-case. Tail call builtin. 2052 // Slow-case. Tail call builtin.
2052 __ bind(&slow); 2053 __ bind(&slow);
2053 if (!ReturnTrueFalseObject()) { 2054 if (!ReturnTrueFalseObject()) {
2054 if (HasArgsInRegisters()) { 2055 if (HasArgsInRegisters()) {
2055 __ Push(r0, r1); 2056 __ Push(r0, r1);
2056 } 2057 }
2057 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 2058 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
2058 } else { 2059 } else {
2059 { 2060 {
2060 FrameScope scope(masm, StackFrame::INTERNAL); 2061 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
2061 __ Push(r0, r1); 2062 __ Push(r0, r1);
2062 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); 2063 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION);
2063 } 2064 }
2064 __ cmp(r0, Operand::Zero()); 2065 __ cmp(r0, Operand::Zero());
2065 __ LoadRoot(r0, Heap::kTrueValueRootIndex, eq); 2066 __ LoadRoot(r0, Heap::kTrueValueRootIndex, eq);
2066 __ LoadRoot(r0, Heap::kFalseValueRootIndex, ne); 2067 __ LoadRoot(r0, Heap::kFalseValueRootIndex, ne);
2067 __ Ret(HasArgsInRegisters() ? 0 : 2); 2068 __ Ret(HasArgsInRegisters() ? 0 : 2);
2068 } 2069 }
2069 } 2070 }
2070 2071
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 // indicate the ElementsKind if function is the Array constructor. 3060 // indicate the ElementsKind if function is the Array constructor.
3060 __ bind(&initialize); 3061 __ bind(&initialize);
3061 // Make sure the function is the Array() function 3062 // Make sure the function is the Array() function
3062 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); 3063 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4);
3063 __ cmp(r1, r4); 3064 __ cmp(r1, r4);
3064 __ b(ne, &not_array_function); 3065 __ b(ne, &not_array_function);
3065 3066
3066 // The target function is the Array constructor, 3067 // The target function is the Array constructor,
3067 // Create an AllocationSite if we don't already have it, store it in the slot. 3068 // Create an AllocationSite if we don't already have it, store it in the slot.
3068 { 3069 {
3069 FrameScope scope(masm, StackFrame::INTERNAL); 3070 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
3070 3071
3071 // Arguments register must be smi-tagged to call out. 3072 // Arguments register must be smi-tagged to call out.
3072 __ SmiTag(r0); 3073 __ SmiTag(r0);
3073 __ Push(r3, r2, r1, r0); 3074 __ Push(r3, r2, r1, r0);
3074 3075
3075 CreateAllocationSiteStub create_stub; 3076 CreateAllocationSiteStub create_stub;
3076 __ CallStub(&create_stub); 3077 __ CallStub(&create_stub);
3077 3078
3078 __ Pop(r3, r2, r1, r0); 3079 __ Pop(r3, r2, r1, r0);
3079 __ SmiUntag(r0); 3080 __ SmiUntag(r0);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 __ mov(r0, Operand(argc_)); // Set up the number of arguments. 3183 __ mov(r0, Operand(argc_)); // Set up the number of arguments.
3183 __ mov(r2, Operand::Zero()); 3184 __ mov(r2, Operand::Zero());
3184 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION); 3185 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION);
3185 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 3186 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
3186 RelocInfo::CODE_TARGET); 3187 RelocInfo::CODE_TARGET);
3187 } 3188 }
3188 3189
3189 if (CallAsMethod()) { 3190 if (CallAsMethod()) {
3190 __ bind(&wrap); 3191 __ bind(&wrap);
3191 // Wrap the receiver and patch it back onto the stack. 3192 // Wrap the receiver and patch it back onto the stack.
3192 { FrameScope frame_scope(masm, StackFrame::INTERNAL); 3193 { FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL);
3193 __ Push(r1, r3); 3194 __ Push(r1, r3);
3194 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 3195 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
3195 __ pop(r1); 3196 __ pop(r1);
3196 } 3197 }
3197 __ str(r0, MemOperand(sp, argc_ * kPointerSize)); 3198 __ str(r0, MemOperand(sp, argc_ * kPointerSize));
3198 __ jmp(&cont); 3199 __ jmp(&cont);
3199 } 3200 }
3200 } 3201 }
3201 3202
3202 3203
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
4467 } 4468 }
4468 4469
4469 4470
4470 4471
4471 void ICCompareStub::GenerateMiss(MacroAssembler* masm) { 4472 void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
4472 { 4473 {
4473 // Call the runtime system in a fresh internal frame. 4474 // Call the runtime system in a fresh internal frame.
4474 ExternalReference miss = 4475 ExternalReference miss =
4475 ExternalReference(IC_Utility(IC::kCompareIC_Miss), masm->isolate()); 4476 ExternalReference(IC_Utility(IC::kCompareIC_Miss), masm->isolate());
4476 4477
4477 FrameScope scope(masm, StackFrame::INTERNAL); 4478 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
4478 __ Push(r1, r0); 4479 __ Push(r1, r0);
4479 __ Push(lr, r1, r0); 4480 __ Push(lr, r1, r0);
4480 __ mov(ip, Operand(Smi::FromInt(op_))); 4481 __ mov(ip, Operand(Smi::FromInt(op_)));
4481 __ push(ip); 4482 __ push(ip);
4482 __ CallExternalReference(miss, 3); 4483 __ CallExternalReference(miss, 3);
4483 // Compute the entry point of the rewritten stub. 4484 // Compute the entry point of the rewritten stub.
4484 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); 4485 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
4485 // Restore registers. 4486 // Restore registers.
4486 __ pop(lr); 4487 __ pop(lr);
4487 __ Pop(r1, r0); 4488 __ Pop(r1, r0);
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
5489 // holder 5490 // holder
5490 __ push(holder); 5491 __ push(holder);
5491 5492
5492 // Prepare arguments. 5493 // Prepare arguments.
5493 __ mov(scratch, sp); 5494 __ mov(scratch, sp);
5494 5495
5495 // Allocate the v8::Arguments structure in the arguments' space since 5496 // Allocate the v8::Arguments structure in the arguments' space since
5496 // it's not controlled by GC. 5497 // it's not controlled by GC.
5497 const int kApiStackSpace = 4; 5498 const int kApiStackSpace = 4;
5498 5499
5499 FrameScope frame_scope(masm, StackFrame::MANUAL); 5500 FrameAndConstantPoolScope frame_scope(masm, StackFrame::MANUAL);
5500 __ EnterExitFrame(false, kApiStackSpace); 5501 __ EnterExitFrame(false, kApiStackSpace);
5501 5502
5502 ASSERT(!api_function_address.is(r0) && !scratch.is(r0)); 5503 ASSERT(!api_function_address.is(r0) && !scratch.is(r0));
5503 // r0 = FunctionCallbackInfo& 5504 // r0 = FunctionCallbackInfo&
5504 // Arguments is after the return address. 5505 // Arguments is after the return address.
5505 __ add(r0, sp, Operand(1 * kPointerSize)); 5506 __ add(r0, sp, Operand(1 * kPointerSize));
5506 // FunctionCallbackInfo::implicit_args_ 5507 // FunctionCallbackInfo::implicit_args_
5507 __ str(scratch, MemOperand(r0, 0 * kPointerSize)); 5508 __ str(scratch, MemOperand(r0, 0 * kPointerSize));
5508 // FunctionCallbackInfo::values_ 5509 // FunctionCallbackInfo::values_
5509 __ add(ip, scratch, Operand((FCA::kArgsLength - 1 + argc) * kPointerSize)); 5510 __ add(ip, scratch, Operand((FCA::kArgsLength - 1 + argc) * kPointerSize));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5549 // -- ... 5550 // -- ...
5550 // -- r2 : api_function_address 5551 // -- r2 : api_function_address
5551 // ----------------------------------- 5552 // -----------------------------------
5552 5553
5553 Register api_function_address = r2; 5554 Register api_function_address = r2;
5554 5555
5555 __ mov(r0, sp); // r0 = Handle<Name> 5556 __ mov(r0, sp); // r0 = Handle<Name>
5556 __ add(r1, r0, Operand(1 * kPointerSize)); // r1 = PCA 5557 __ add(r1, r0, Operand(1 * kPointerSize)); // r1 = PCA
5557 5558
5558 const int kApiStackSpace = 1; 5559 const int kApiStackSpace = 1;
5559 FrameScope frame_scope(masm, StackFrame::MANUAL); 5560 FrameAndConstantPoolScope frame_scope(masm, StackFrame::MANUAL);
5560 __ EnterExitFrame(false, kApiStackSpace); 5561 __ EnterExitFrame(false, kApiStackSpace);
5561 5562
5562 // Create PropertyAccessorInfo instance on the stack above the exit frame with 5563 // Create PropertyAccessorInfo instance on the stack above the exit frame with
5563 // r1 (internal::Object** args_) as the data. 5564 // r1 (internal::Object** args_) as the data.
5564 __ str(r1, MemOperand(sp, 1 * kPointerSize)); 5565 __ str(r1, MemOperand(sp, 1 * kPointerSize));
5565 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& 5566 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo&
5566 5567
5567 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5568 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5568 5569
5569 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); 5570 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
5570 ExternalReference::Type thunk_type = 5571 ExternalReference::Type thunk_type =
5571 ExternalReference::PROFILING_GETTER_CALL; 5572 ExternalReference::PROFILING_GETTER_CALL;
5572 ApiFunction thunk_fun(thunk_address); 5573 ApiFunction thunk_fun(thunk_address);
5573 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, 5574 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
5574 masm->isolate()); 5575 masm->isolate());
5575 __ CallApiFunctionAndReturn(api_function_address, 5576 __ CallApiFunctionAndReturn(api_function_address,
5576 thunk_ref, 5577 thunk_ref,
5577 kStackUnwindSpace, 5578 kStackUnwindSpace,
5578 MemOperand(fp, 6 * kPointerSize), 5579 MemOperand(fp, 6 * kPointerSize),
5579 NULL); 5580 NULL);
5580 } 5581 }
5581 5582
5582 5583
5583 #undef __ 5584 #undef __
5584 5585
5585 } } // namespace v8::internal 5586 } } // namespace v8::internal
5586 5587
5587 #endif // V8_TARGET_ARCH_ARM 5588 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/debug-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698