| Index: src/arm/stub-cache-arm.cc
|
| diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc
|
| index 7f673c144778d3c17be7da329667b4c5849f0aa9..0c7df71eaf646d0cdb451a05035843daa77e1359 100644
|
| --- a/src/arm/stub-cache-arm.cc
|
| +++ b/src/arm/stub-cache-arm.cc
|
| @@ -295,15 +295,20 @@ void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
|
| Register prototype,
|
| Label* miss) {
|
| Isolate* isolate = masm->isolate();
|
| - // Check we're still in the same context.
|
| - __ ldr(prototype,
|
| - MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
| - __ Move(ip, isolate->global_object());
|
| - __ cmp(prototype, ip);
|
| - __ b(ne, miss);
|
| // Get the global function with the given index.
|
| Handle<JSFunction> function(
|
| JSFunction::cast(isolate->native_context()->get(index)));
|
| +
|
| + // Check we're still in the same context.
|
| + Register scratch = prototype;
|
| + const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
|
| + __ ldr(scratch, MemOperand(cp, offset));
|
| + __ ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
|
| + __ ldr(scratch, MemOperand(scratch, Context::SlotOffset(index)));
|
| + __ Move(ip, function);
|
| + __ cmp(ip, scratch);
|
| + __ b(ne, miss);
|
| +
|
| // Load its initial map. The global functions all have initial maps.
|
| __ Move(prototype, Handle<Map>(function->initial_map()));
|
| // Load the prototype from the initial map.
|
| @@ -777,340 +782,84 @@ static void CompileCallLoadPropertyWithInterceptor(
|
| }
|
|
|
|
|
| -static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength;
|
| -
|
| -// Reserves space for the extra arguments to API function in the
|
| -// caller's frame.
|
| -//
|
| -// These arguments are set by CheckPrototypes and GenerateFastApiDirectCall.
|
| -static void ReserveSpaceForFastApiCall(MacroAssembler* masm,
|
| - Register scratch) {
|
| - __ mov(scratch, Operand(Smi::FromInt(0)));
|
| - for (int i = 0; i < kFastApiCallArguments; i++) {
|
| - __ push(scratch);
|
| +// Generate call to api function.
|
| +void StubCompiler::GenerateFastApiCall(MacroAssembler* masm,
|
| + const CallOptimization& optimization,
|
| + Handle<Map> receiver_map,
|
| + Register receiver,
|
| + Register scratch_in,
|
| + bool is_store,
|
| + int argc,
|
| + Register* values) {
|
| + ASSERT(!receiver.is(scratch_in));
|
| + __ push(receiver);
|
| + // Write the arguments to stack frame.
|
| + for (int i = 0; i < argc; i++) {
|
| + Register arg = values[argc-1-i];
|
| + ASSERT(!receiver.is(arg));
|
| + ASSERT(!scratch_in.is(arg));
|
| + __ push(arg);
|
| }
|
| -}
|
| -
|
| -
|
| -// Undoes the effects of ReserveSpaceForFastApiCall.
|
| -static void FreeSpaceForFastApiCall(MacroAssembler* masm) {
|
| - __ Drop(kFastApiCallArguments);
|
| -}
|
| + ASSERT(optimization.is_simple_api_call());
|
|
|
| + // Abi for CallApiFunctionStub.
|
| + Register callee = r0;
|
| + Register call_data = r4;
|
| + Register holder = r2;
|
| + Register api_function_address = r1;
|
| +
|
| + // Put holder in place.
|
| + CallOptimization::HolderLookup holder_lookup;
|
| + Handle<JSObject> api_holder = optimization.LookupHolderOfExpectedType(
|
| + receiver_map,
|
| + &holder_lookup);
|
| + switch (holder_lookup) {
|
| + case CallOptimization::kHolderIsReceiver:
|
| + __ Move(holder, receiver);
|
| + break;
|
| + case CallOptimization::kHolderFound:
|
| + __ Move(holder, api_holder);
|
| + break;
|
| + case CallOptimization::kHolderNotFound:
|
| + UNREACHABLE();
|
| + break;
|
| + }
|
|
|
| -static void GenerateFastApiDirectCall(MacroAssembler* masm,
|
| - const CallOptimization& optimization,
|
| - int argc,
|
| - bool restore_context) {
|
| - // ----------- S t a t e -------------
|
| - // -- sp[0] - sp[24] : FunctionCallbackInfo, incl.
|
| - // : holder (set by CheckPrototypes)
|
| - // -- sp[28] : last JS argument
|
| - // -- ...
|
| - // -- sp[(argc + 6) * 4] : first JS argument
|
| - // -- sp[(argc + 7) * 4] : receiver
|
| - // -----------------------------------
|
| - typedef FunctionCallbackArguments FCA;
|
| - // Save calling context.
|
| - __ str(cp, MemOperand(sp, FCA::kContextSaveIndex * kPointerSize));
|
| - // Get the function and setup the context.
|
| + Isolate* isolate = masm->isolate();
|
| Handle<JSFunction> function = optimization.constant_function();
|
| - __ Move(r5, function);
|
| - __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset));
|
| - __ str(r5, MemOperand(sp, FCA::kCalleeIndex * kPointerSize));
|
| -
|
| - // Construct the FunctionCallbackInfo.
|
| Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
| - Handle<Object> call_data(api_call_info->data(), masm->isolate());
|
| - if (masm->isolate()->heap()->InNewSpace(*call_data)) {
|
| - __ Move(r0, api_call_info);
|
| - __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset));
|
| + Handle<Object> call_data_obj(api_call_info->data(), isolate);
|
| +
|
| + // Put callee in place.
|
| + __ Move(callee, function);
|
| +
|
| + bool call_data_undefined = false;
|
| + // Put call_data in place.
|
| + if (isolate->heap()->InNewSpace(*call_data_obj)) {
|
| + __ Move(call_data, api_call_info);
|
| + __ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
|
| + } else if (call_data_obj->IsUndefined()) {
|
| + call_data_undefined = true;
|
| + __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
|
| } else {
|
| - __ Move(r6, call_data);
|
| + __ Move(call_data, call_data_obj);
|
| }
|
| - // Store call data.
|
| - __ str(r6, MemOperand(sp, FCA::kDataIndex * kPointerSize));
|
| - // Store isolate.
|
| - __ mov(r5, Operand(ExternalReference::isolate_address(masm->isolate())));
|
| - __ str(r5, MemOperand(sp, FCA::kIsolateIndex * kPointerSize));
|
| - // Store ReturnValue default and ReturnValue.
|
| - __ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
|
| - __ str(r5, MemOperand(sp, FCA::kReturnValueOffset * kPointerSize));
|
| - __ str(r5, MemOperand(sp, FCA::kReturnValueDefaultValueIndex * kPointerSize));
|
| -
|
| - // Prepare arguments.
|
| - __ mov(r2, sp);
|
| -
|
| - // Allocate the v8::Arguments structure in the arguments' space since
|
| - // it's not controlled by GC.
|
| - const int kApiStackSpace = 4;
|
| -
|
| - FrameScope frame_scope(masm, StackFrame::MANUAL);
|
| - __ EnterExitFrame(false, kApiStackSpace);
|
| -
|
| - // r0 = FunctionCallbackInfo&
|
| - // Arguments is after the return address.
|
| - __ add(r0, sp, Operand(1 * kPointerSize));
|
| - // FunctionCallbackInfo::implicit_args_
|
| - __ str(r2, MemOperand(r0, 0 * kPointerSize));
|
| - // FunctionCallbackInfo::values_
|
| - __ add(ip, r2, Operand((kFastApiCallArguments - 1 + argc) * kPointerSize));
|
| - __ str(ip, MemOperand(r0, 1 * kPointerSize));
|
| - // FunctionCallbackInfo::length_ = argc
|
| - __ mov(ip, Operand(argc));
|
| - __ str(ip, MemOperand(r0, 2 * kPointerSize));
|
| - // FunctionCallbackInfo::is_construct_call = 0
|
| - __ mov(ip, Operand::Zero());
|
| - __ str(ip, MemOperand(r0, 3 * kPointerSize));
|
| -
|
| - const int kStackUnwindSpace = argc + kFastApiCallArguments + 1;
|
| +
|
| + // Put api_function_address in place.
|
| Address function_address = v8::ToCData<Address>(api_call_info->callback());
|
| ApiFunction fun(function_address);
|
| ExternalReference::Type type = ExternalReference::DIRECT_API_CALL;
|
| ExternalReference ref = ExternalReference(&fun,
|
| type,
|
| masm->isolate());
|
| - Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
|
| - ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL;
|
| - ApiFunction thunk_fun(thunk_address);
|
| - ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
|
| - masm->isolate());
|
| -
|
| - AllowExternalCallThatCantCauseGC scope(masm);
|
| - MemOperand context_restore_operand(
|
| - fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
|
| - MemOperand return_value_operand(fp,
|
| - (2 + FCA::kReturnValueOffset) * kPointerSize);
|
| -
|
| - __ CallApiFunctionAndReturn(ref,
|
| - function_address,
|
| - thunk_ref,
|
| - r1,
|
| - kStackUnwindSpace,
|
| - return_value_operand,
|
| - restore_context ?
|
| - &context_restore_operand : NULL);
|
| -}
|
| + __ mov(api_function_address, Operand(ref));
|
|
|
| -
|
| -// Generate call to api function.
|
| -static void GenerateFastApiCall(MacroAssembler* masm,
|
| - const CallOptimization& optimization,
|
| - Register receiver,
|
| - Register scratch,
|
| - int argc,
|
| - Register* values) {
|
| - ASSERT(optimization.is_simple_api_call());
|
| - ASSERT(!receiver.is(scratch));
|
| -
|
| - typedef FunctionCallbackArguments FCA;
|
| - const int stack_space = kFastApiCallArguments + argc + 1;
|
| - // Assign stack space for the call arguments.
|
| - __ sub(sp, sp, Operand(stack_space * kPointerSize));
|
| - // Write holder to stack frame.
|
| - __ str(receiver, MemOperand(sp, FCA::kHolderIndex * kPointerSize));
|
| - // Write receiver to stack frame.
|
| - int index = stack_space - 1;
|
| - __ str(receiver, MemOperand(sp, index-- * kPointerSize));
|
| - // Write the arguments to stack frame.
|
| - for (int i = 0; i < argc; i++) {
|
| - ASSERT(!receiver.is(values[i]));
|
| - ASSERT(!scratch.is(values[i]));
|
| - __ str(values[i], MemOperand(sp, index-- * kPointerSize));
|
| - }
|
| -
|
| - GenerateFastApiDirectCall(masm, optimization, argc, true);
|
| + // Jump to stub.
|
| + CallApiFunctionStub stub(is_store, call_data_undefined, argc);
|
| + __ TailCallStub(&stub);
|
| }
|
|
|
|
|
| -class CallInterceptorCompiler BASE_EMBEDDED {
|
| - public:
|
| - CallInterceptorCompiler(CallStubCompiler* stub_compiler,
|
| - const ParameterCount& arguments,
|
| - Register name)
|
| - : stub_compiler_(stub_compiler),
|
| - arguments_(arguments),
|
| - name_(name) {}
|
| -
|
| - void Compile(MacroAssembler* masm,
|
| - Handle<JSObject> object,
|
| - Handle<JSObject> holder,
|
| - Handle<Name> name,
|
| - LookupResult* lookup,
|
| - Register receiver,
|
| - Register scratch1,
|
| - Register scratch2,
|
| - Register scratch3,
|
| - Label* miss) {
|
| - ASSERT(holder->HasNamedInterceptor());
|
| - ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined());
|
| -
|
| - // Check that the receiver isn't a smi.
|
| - __ JumpIfSmi(receiver, miss);
|
| - CallOptimization optimization(lookup);
|
| - if (optimization.is_constant_call()) {
|
| - CompileCacheable(masm, object, receiver, scratch1, scratch2, scratch3,
|
| - holder, lookup, name, optimization, miss);
|
| - } else {
|
| - CompileRegular(masm, object, receiver, scratch1, scratch2, scratch3,
|
| - name, holder, miss);
|
| - }
|
| - }
|
| -
|
| - private:
|
| - void CompileCacheable(MacroAssembler* masm,
|
| - Handle<JSObject> object,
|
| - Register receiver,
|
| - Register scratch1,
|
| - Register scratch2,
|
| - Register scratch3,
|
| - Handle<JSObject> interceptor_holder,
|
| - LookupResult* lookup,
|
| - Handle<Name> name,
|
| - const CallOptimization& optimization,
|
| - Label* miss_label) {
|
| - ASSERT(optimization.is_constant_call());
|
| - ASSERT(!lookup->holder()->IsGlobalObject());
|
| - Counters* counters = masm->isolate()->counters();
|
| - int depth1 = kInvalidProtoDepth;
|
| - int depth2 = kInvalidProtoDepth;
|
| - bool can_do_fast_api_call = false;
|
| - if (optimization.is_simple_api_call() &&
|
| - !lookup->holder()->IsGlobalObject()) {
|
| - depth1 = optimization.GetPrototypeDepthOfExpectedType(
|
| - object, interceptor_holder);
|
| - if (depth1 == kInvalidProtoDepth) {
|
| - depth2 = optimization.GetPrototypeDepthOfExpectedType(
|
| - interceptor_holder, Handle<JSObject>(lookup->holder()));
|
| - }
|
| - can_do_fast_api_call =
|
| - depth1 != kInvalidProtoDepth || depth2 != kInvalidProtoDepth;
|
| - }
|
| -
|
| - __ IncrementCounter(counters->call_const_interceptor(), 1,
|
| - scratch1, scratch2);
|
| -
|
| - if (can_do_fast_api_call) {
|
| - __ IncrementCounter(counters->call_const_interceptor_fast_api(), 1,
|
| - scratch1, scratch2);
|
| - ReserveSpaceForFastApiCall(masm, scratch1);
|
| - }
|
| -
|
| - // Check that the maps from receiver to interceptor's holder
|
| - // haven't changed and thus we can invoke interceptor.
|
| - Label miss_cleanup;
|
| - Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label;
|
| - Register holder =
|
| - stub_compiler_->CheckPrototypes(
|
| - IC::CurrentTypeOf(object, masm->isolate()), receiver,
|
| - interceptor_holder, scratch1, scratch2, scratch3,
|
| - name, depth1, miss);
|
| -
|
| - // Invoke an interceptor and if it provides a value,
|
| - // branch to |regular_invoke|.
|
| - Label regular_invoke;
|
| - LoadWithInterceptor(masm, receiver, holder, interceptor_holder, scratch2,
|
| - ®ular_invoke);
|
| -
|
| - // Interceptor returned nothing for this property. Try to use cached
|
| - // constant function.
|
| -
|
| - // Check that the maps from interceptor's holder to constant function's
|
| - // holder haven't changed and thus we can use cached constant function.
|
| - if (*interceptor_holder != lookup->holder()) {
|
| - stub_compiler_->CheckPrototypes(
|
| - IC::CurrentTypeOf(interceptor_holder, masm->isolate()), holder,
|
| - handle(lookup->holder()), scratch1, scratch2, scratch3,
|
| - name, depth2, miss);
|
| - } else {
|
| - // CheckPrototypes has a side effect of fetching a 'holder'
|
| - // for API (object which is instanceof for the signature). It's
|
| - // safe to omit it here, as if present, it should be fetched
|
| - // by the previous CheckPrototypes.
|
| - ASSERT(depth2 == kInvalidProtoDepth);
|
| - }
|
| -
|
| - // Invoke function.
|
| - if (can_do_fast_api_call) {
|
| - GenerateFastApiDirectCall(
|
| - masm, optimization, arguments_.immediate(), false);
|
| - } else {
|
| - Handle<JSFunction> function = optimization.constant_function();
|
| - __ Move(r0, receiver);
|
| - stub_compiler_->GenerateJumpFunction(object, function);
|
| - }
|
| -
|
| - // Deferred code for fast API call case---clean preallocated space.
|
| - if (can_do_fast_api_call) {
|
| - __ bind(&miss_cleanup);
|
| - FreeSpaceForFastApiCall(masm);
|
| - __ b(miss_label);
|
| - }
|
| -
|
| - // Invoke a regular function.
|
| - __ bind(®ular_invoke);
|
| - if (can_do_fast_api_call) {
|
| - FreeSpaceForFastApiCall(masm);
|
| - }
|
| - }
|
| -
|
| - void CompileRegular(MacroAssembler* masm,
|
| - Handle<JSObject> object,
|
| - Register receiver,
|
| - Register scratch1,
|
| - Register scratch2,
|
| - Register scratch3,
|
| - Handle<Name> name,
|
| - Handle<JSObject> interceptor_holder,
|
| - Label* miss_label) {
|
| - Register holder =
|
| - stub_compiler_->CheckPrototypes(
|
| - IC::CurrentTypeOf(object, masm->isolate()), receiver,
|
| - interceptor_holder, scratch1, scratch2, scratch3, name, miss_label);
|
| -
|
| - // Call a runtime function to load the interceptor property.
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| - // Save the name_ register across the call.
|
| - __ push(name_);
|
| -
|
| - CompileCallLoadPropertyWithInterceptor(
|
| - masm, receiver, holder, name_, interceptor_holder,
|
| - IC::kLoadPropertyWithInterceptorForCall);
|
| -
|
| - // Restore the name_ register.
|
| - __ pop(name_);
|
| - // Leave the internal frame.
|
| - }
|
| -
|
| - void LoadWithInterceptor(MacroAssembler* masm,
|
| - Register receiver,
|
| - Register holder,
|
| - Handle<JSObject> holder_obj,
|
| - Register scratch,
|
| - Label* interceptor_succeeded) {
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| - __ Push(receiver);
|
| - __ Push(holder, name_);
|
| - CompileCallLoadPropertyWithInterceptor(
|
| - masm, receiver, holder, name_, holder_obj,
|
| - IC::kLoadPropertyWithInterceptorOnly);
|
| - __ pop(name_);
|
| - __ pop(holder);
|
| - __ pop(receiver);
|
| - }
|
| - // If interceptor returns no-result sentinel, call the constant function.
|
| - __ LoadRoot(scratch, Heap::kNoInterceptorResultSentinelRootIndex);
|
| - __ cmp(r0, scratch);
|
| - __ b(ne, interceptor_succeeded);
|
| - }
|
| -
|
| - CallStubCompiler* stub_compiler_;
|
| - const ParameterCount& arguments_;
|
| - Register name_;
|
| -};
|
| -
|
| -
|
| void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
|
| __ Jump(code, RelocInfo::CODE_TARGET);
|
| }
|
| @@ -1120,20 +869,16 @@ void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
|
| #define __ ACCESS_MASM(masm())
|
|
|
|
|
| -Register StubCompiler::CheckPrototypes(Handle<Type> type,
|
| +Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
|
| Register object_reg,
|
| Handle<JSObject> holder,
|
| Register holder_reg,
|
| Register scratch1,
|
| Register scratch2,
|
| Handle<Name> name,
|
| - int save_at_depth,
|
| Label* miss,
|
| PrototypeCheckType check) {
|
| Handle<Map> receiver_map(IC::TypeToMap(*type, isolate()));
|
| - // Make sure that the type feedback oracle harvests the receiver map.
|
| - // TODO(svenpanne) Remove this hack when all ICs are reworked.
|
| - __ mov(scratch1, Operand(receiver_map));
|
|
|
| // Make sure there's no overlap between holder and object registers.
|
| ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
|
| @@ -1144,11 +889,6 @@ Register StubCompiler::CheckPrototypes(Handle<Type> type,
|
| Register reg = object_reg;
|
| int depth = 0;
|
|
|
| - typedef FunctionCallbackArguments FCA;
|
| - if (save_at_depth == depth) {
|
| - __ str(reg, MemOperand(sp, FCA::kHolderIndex * kPointerSize));
|
| - }
|
| -
|
| Handle<JSObject> current = Handle<JSObject>::null();
|
| if (type->IsConstant()) current = Handle<JSObject>::cast(type->AsConstant());
|
| Handle<JSObject> prototype = Handle<JSObject>::null();
|
| @@ -1214,10 +954,6 @@ Register StubCompiler::CheckPrototypes(Handle<Type> type,
|
| }
|
| }
|
|
|
| - if (save_at_depth == depth) {
|
| - __ str(reg, MemOperand(sp, FCA::kHolderIndex * kPointerSize));
|
| - }
|
| -
|
| // Go to the next object in the prototype chain.
|
| current = prototype;
|
| current_map = handle(current->map());
|
| @@ -1266,7 +1002,7 @@ void StoreStubCompiler::HandlerFrontendFooter(Handle<Name> name, Label* miss) {
|
|
|
|
|
| Register LoadStubCompiler::CallbackHandlerFrontend(
|
| - Handle<Type> type,
|
| + Handle<HeapType> type,
|
| Register object_reg,
|
| Handle<JSObject> holder,
|
| Handle<Name> name,
|
| @@ -1338,13 +1074,6 @@ void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
|
|
|
|
|
| void LoadStubCompiler::GenerateLoadCallback(
|
| - const CallOptimization& call_optimization) {
|
| - GenerateFastApiCall(
|
| - masm(), call_optimization, receiver(), scratch3(), 0, NULL);
|
| -}
|
| -
|
| -
|
| -void LoadStubCompiler::GenerateLoadCallback(
|
| Register reg,
|
| Handle<ExecutableAccessorInfo> callback) {
|
| // Build AccessorInfo::args_ list on the stack and push property name below
|
| @@ -1376,37 +1105,18 @@ void LoadStubCompiler::GenerateLoadCallback(
|
| __ Push(scratch4(), reg);
|
| __ mov(scratch2(), sp); // scratch2 = PropertyAccessorInfo::args_
|
| __ push(name());
|
| - __ mov(r0, sp); // r0 = Handle<Name>
|
|
|
| - const int kApiStackSpace = 1;
|
| - FrameScope frame_scope(masm(), StackFrame::MANUAL);
|
| - __ EnterExitFrame(false, kApiStackSpace);
|
| + // Abi for CallApiGetter
|
| + Register getter_address_reg = r2;
|
|
|
| - // Create PropertyAccessorInfo instance on the stack above the exit frame with
|
| - // scratch2 (internal::Object** args_) as the data.
|
| - __ str(scratch2(), MemOperand(sp, 1 * kPointerSize));
|
| - __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo&
|
| -
|
| - const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
|
| Address getter_address = v8::ToCData<Address>(callback->getter());
|
| -
|
| ApiFunction fun(getter_address);
|
| ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
|
| ExternalReference ref = ExternalReference(&fun, type, isolate());
|
| + __ mov(getter_address_reg, Operand(ref));
|
|
|
| - Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback);
|
| - ExternalReference::Type thunk_type =
|
| - ExternalReference::PROFILING_GETTER_CALL;
|
| - ApiFunction thunk_fun(thunk_address);
|
| - ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
|
| - isolate());
|
| - __ CallApiFunctionAndReturn(ref,
|
| - getter_address,
|
| - thunk_ref,
|
| - r2,
|
| - kStackUnwindSpace,
|
| - MemOperand(fp, 6 * kPointerSize),
|
| - NULL);
|
| + CallApiGetterStub stub;
|
| + __ TailCallStub(&stub);
|
| }
|
|
|
|
|
| @@ -1498,448 +1208,6 @@ void LoadStubCompiler::GenerateLoadInterceptor(
|
| }
|
|
|
|
|
| -void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) {
|
| - if (kind_ == Code::KEYED_CALL_IC) {
|
| - __ cmp(r2, Operand(name));
|
| - __ b(ne, miss);
|
| - }
|
| -}
|
| -
|
| -
|
| -void CallStubCompiler::GenerateFunctionCheck(Register function,
|
| - Register scratch,
|
| - Label* miss) {
|
| - __ JumpIfSmi(function, miss);
|
| - __ CompareObjectType(function, scratch, scratch, JS_FUNCTION_TYPE);
|
| - __ b(ne, miss);
|
| -}
|
| -
|
| -
|
| -void CallStubCompiler::GenerateLoadFunctionFromCell(
|
| - Handle<Cell> cell,
|
| - Handle<JSFunction> function,
|
| - Label* miss) {
|
| - // Get the value from the cell.
|
| - __ mov(r3, Operand(cell));
|
| - __ ldr(r1, FieldMemOperand(r3, Cell::kValueOffset));
|
| -
|
| - // Check that the cell contains the same function.
|
| - if (heap()->InNewSpace(*function)) {
|
| - // We can't embed a pointer to a function in new space so we have
|
| - // to verify that the shared function info is unchanged. This has
|
| - // the nice side effect that multiple closures based on the same
|
| - // function can all use this call IC. Before we load through the
|
| - // function, we have to verify that it still is a function.
|
| - GenerateFunctionCheck(r1, r3, miss);
|
| -
|
| - // Check the shared function info. Make sure it hasn't changed.
|
| - __ Move(r3, Handle<SharedFunctionInfo>(function->shared()));
|
| - __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
|
| - __ cmp(r4, r3);
|
| - } else {
|
| - __ cmp(r1, Operand(function));
|
| - }
|
| - __ b(ne, miss);
|
| -}
|
| -
|
| -
|
| -void CallStubCompiler::GenerateMissBranch() {
|
| - Handle<Code> code =
|
| - isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
|
| - kind_,
|
| - extra_state());
|
| - __ Jump(code, RelocInfo::CODE_TARGET);
|
| -}
|
| -
|
| -
|
| -Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
|
| - Handle<JSObject> holder,
|
| - PropertyIndex index,
|
| - Handle<Name> name) {
|
| - Label miss;
|
| -
|
| - Register reg = HandlerFrontendHeader(
|
| - object, holder, name, RECEIVER_MAP_CHECK, &miss);
|
| - GenerateFastPropertyLoad(masm(), r1, reg, index.is_inobject(holder),
|
| - index.translate(holder), Representation::Tagged());
|
| - GenerateJumpFunction(object, r1, &miss);
|
| -
|
| - HandlerFrontendFooter(&miss);
|
| -
|
| - // Return the generated code.
|
| - return GetCode(Code::FAST, name);
|
| -}
|
| -
|
| -
|
| -Handle<Code> CallStubCompiler::CompileArrayPushCall(
|
| - Handle<Object> object,
|
| - Handle<JSObject> holder,
|
| - Handle<Cell> cell,
|
| - Handle<JSFunction> function,
|
| - Handle<String> name,
|
| - Code::StubType type) {
|
| - // If object is not an array or is observed or sealed, bail out to regular
|
| - // call.
|
| - if (!object->IsJSArray() ||
|
| - !cell.is_null() ||
|
| - Handle<JSArray>::cast(object)->map()->is_observed() ||
|
| - !Handle<JSArray>::cast(object)->map()->is_extensible()) {
|
| - return Handle<Code>::null();
|
| - }
|
| -
|
| - Label miss;
|
| -
|
| - HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
|
| - Register receiver = r0;
|
| - Register scratch = r1;
|
| -
|
| - const int argc = arguments().immediate();
|
| - if (argc == 0) {
|
| - // Nothing to do, just return the length.
|
| - __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| - __ Drop(argc + 1);
|
| - __ Ret();
|
| - } else {
|
| - Label call_builtin;
|
| -
|
| - if (argc == 1) { // Otherwise fall through to call the builtin.
|
| - Label attempt_to_grow_elements, with_write_barrier, check_double;
|
| -
|
| - Register elements = r6;
|
| - Register end_elements = r5;
|
| - // Get the elements array of the object.
|
| - __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset));
|
| -
|
| - // Check that the elements are in fast mode and writable.
|
| - __ CheckMap(elements,
|
| - scratch,
|
| - Heap::kFixedArrayMapRootIndex,
|
| - &check_double,
|
| - DONT_DO_SMI_CHECK);
|
| -
|
| - // Get the array's length into scratch and calculate new length.
|
| - __ ldr(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| - __ add(scratch, scratch, Operand(Smi::FromInt(argc)));
|
| -
|
| - // Get the elements' length.
|
| - __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset));
|
| -
|
| - // Check if we could survive without allocation.
|
| - __ cmp(scratch, r4);
|
| - __ b(gt, &attempt_to_grow_elements);
|
| -
|
| - // Check if value is a smi.
|
| - __ ldr(r4, MemOperand(sp, (argc - 1) * kPointerSize));
|
| - __ JumpIfNotSmi(r4, &with_write_barrier);
|
| -
|
| - // Save new length.
|
| - __ str(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| -
|
| - // Store the value.
|
| - // We may need a register containing the address end_elements below,
|
| - // so write back the value in end_elements.
|
| - __ add(end_elements, elements, Operand::PointerOffsetFromSmiKey(scratch));
|
| - const int kEndElementsOffset =
|
| - FixedArray::kHeaderSize - kHeapObjectTag - argc * kPointerSize;
|
| - __ str(r4, MemOperand(end_elements, kEndElementsOffset, PreIndex));
|
| -
|
| - // Check for a smi.
|
| - __ Drop(argc + 1);
|
| - __ mov(r0, scratch);
|
| - __ Ret();
|
| -
|
| - __ bind(&check_double);
|
| -
|
| - // Check that the elements are in fast mode and writable.
|
| - __ CheckMap(elements,
|
| - scratch,
|
| - Heap::kFixedDoubleArrayMapRootIndex,
|
| - &call_builtin,
|
| - DONT_DO_SMI_CHECK);
|
| -
|
| - // Get the array's length into scratch and calculate new length.
|
| - __ ldr(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| - __ add(scratch, scratch, Operand(Smi::FromInt(argc)));
|
| -
|
| - // Get the elements' length.
|
| - __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset));
|
| -
|
| - // Check if we could survive without allocation.
|
| - __ cmp(scratch, r4);
|
| - __ b(gt, &call_builtin);
|
| -
|
| - __ ldr(r4, MemOperand(sp, (argc - 1) * kPointerSize));
|
| - __ StoreNumberToDoubleElements(r4, scratch, elements, r5, d0,
|
| - &call_builtin, argc * kDoubleSize);
|
| -
|
| - // Save new length.
|
| - __ str(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| -
|
| - __ Drop(argc + 1);
|
| - __ mov(r0, scratch);
|
| - __ Ret();
|
| -
|
| - __ bind(&with_write_barrier);
|
| -
|
| - __ ldr(r3, FieldMemOperand(receiver, HeapObject::kMapOffset));
|
| -
|
| - if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) {
|
| - Label fast_object, not_fast_object;
|
| - __ CheckFastObjectElements(r3, r9, ¬_fast_object);
|
| - __ jmp(&fast_object);
|
| - // In case of fast smi-only, convert to fast object, otherwise bail out.
|
| - __ bind(¬_fast_object);
|
| - __ CheckFastSmiElements(r3, r9, &call_builtin);
|
| -
|
| - __ ldr(r9, FieldMemOperand(r4, HeapObject::kMapOffset));
|
| - __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
|
| - __ cmp(r9, ip);
|
| - __ b(eq, &call_builtin);
|
| - // edx: receiver
|
| - // r3: map
|
| - Label try_holey_map;
|
| - __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
|
| - FAST_ELEMENTS,
|
| - r3,
|
| - r9,
|
| - &try_holey_map);
|
| - __ mov(r2, receiver);
|
| - ElementsTransitionGenerator::
|
| - GenerateMapChangeElementsTransition(masm(),
|
| - DONT_TRACK_ALLOCATION_SITE,
|
| - NULL);
|
| - __ jmp(&fast_object);
|
| -
|
| - __ bind(&try_holey_map);
|
| - __ LoadTransitionedArrayMapConditional(FAST_HOLEY_SMI_ELEMENTS,
|
| - FAST_HOLEY_ELEMENTS,
|
| - r3,
|
| - r9,
|
| - &call_builtin);
|
| - __ mov(r2, receiver);
|
| - ElementsTransitionGenerator::
|
| - GenerateMapChangeElementsTransition(masm(),
|
| - DONT_TRACK_ALLOCATION_SITE,
|
| - NULL);
|
| - __ bind(&fast_object);
|
| - } else {
|
| - __ CheckFastObjectElements(r3, r3, &call_builtin);
|
| - }
|
| -
|
| - // Save new length.
|
| - __ str(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| -
|
| - // Store the value.
|
| - // We may need a register containing the address end_elements below,
|
| - // so write back the value in end_elements.
|
| - __ add(end_elements, elements, Operand::PointerOffsetFromSmiKey(scratch));
|
| - __ str(r4, MemOperand(end_elements, kEndElementsOffset, PreIndex));
|
| -
|
| - __ RecordWrite(elements,
|
| - end_elements,
|
| - r4,
|
| - kLRHasNotBeenSaved,
|
| - kDontSaveFPRegs,
|
| - EMIT_REMEMBERED_SET,
|
| - OMIT_SMI_CHECK);
|
| - __ Drop(argc + 1);
|
| - __ mov(r0, scratch);
|
| - __ Ret();
|
| -
|
| - __ bind(&attempt_to_grow_elements);
|
| - // scratch: array's length + 1.
|
| -
|
| - if (!FLAG_inline_new) {
|
| - __ b(&call_builtin);
|
| - }
|
| -
|
| - __ ldr(r2, MemOperand(sp, (argc - 1) * kPointerSize));
|
| - // Growing elements that are SMI-only requires special handling in case
|
| - // the new element is non-Smi. For now, delegate to the builtin.
|
| - Label no_fast_elements_check;
|
| - __ JumpIfSmi(r2, &no_fast_elements_check);
|
| - __ ldr(r9, FieldMemOperand(receiver, HeapObject::kMapOffset));
|
| - __ CheckFastObjectElements(r9, r9, &call_builtin);
|
| - __ bind(&no_fast_elements_check);
|
| -
|
| - ExternalReference new_space_allocation_top =
|
| - ExternalReference::new_space_allocation_top_address(isolate());
|
| - ExternalReference new_space_allocation_limit =
|
| - ExternalReference::new_space_allocation_limit_address(isolate());
|
| -
|
| - const int kAllocationDelta = 4;
|
| - // Load top and check if it is the end of elements.
|
| - __ add(end_elements, elements, Operand::PointerOffsetFromSmiKey(scratch));
|
| - __ add(end_elements, end_elements, Operand(kEndElementsOffset));
|
| - __ mov(r4, Operand(new_space_allocation_top));
|
| - __ ldr(r3, MemOperand(r4));
|
| - __ cmp(end_elements, r3);
|
| - __ b(ne, &call_builtin);
|
| -
|
| - __ mov(r9, Operand(new_space_allocation_limit));
|
| - __ ldr(r9, MemOperand(r9));
|
| - __ add(r3, r3, Operand(kAllocationDelta * kPointerSize));
|
| - __ cmp(r3, r9);
|
| - __ b(hi, &call_builtin);
|
| -
|
| - // We fit and could grow elements.
|
| - // Update new_space_allocation_top.
|
| - __ str(r3, MemOperand(r4));
|
| - // Push the argument.
|
| - __ str(r2, MemOperand(end_elements));
|
| - // Fill the rest with holes.
|
| - __ LoadRoot(r3, Heap::kTheHoleValueRootIndex);
|
| - for (int i = 1; i < kAllocationDelta; i++) {
|
| - __ str(r3, MemOperand(end_elements, i * kPointerSize));
|
| - }
|
| -
|
| - // Update elements' and array's sizes.
|
| - __ str(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| - __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset));
|
| - __ add(r4, r4, Operand(Smi::FromInt(kAllocationDelta)));
|
| - __ str(r4, FieldMemOperand(elements, FixedArray::kLengthOffset));
|
| -
|
| - // Elements are in new space, so write barrier is not required.
|
| - __ Drop(argc + 1);
|
| - __ mov(r0, scratch);
|
| - __ Ret();
|
| - }
|
| - __ bind(&call_builtin);
|
| - __ TailCallExternalReference(
|
| - ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1);
|
| - }
|
| -
|
| - HandlerFrontendFooter(&miss);
|
| -
|
| - // Return the generated code.
|
| - return GetCode(type, name);
|
| -}
|
| -
|
| -
|
| -Handle<Code> CallStubCompiler::CompileArrayPopCall(
|
| - Handle<Object> object,
|
| - Handle<JSObject> holder,
|
| - Handle<Cell> cell,
|
| - Handle<JSFunction> function,
|
| - Handle<String> name,
|
| - Code::StubType type) {
|
| - // If object is not an array or is observed or sealed, bail out to regular
|
| - // call.
|
| - if (!object->IsJSArray() ||
|
| - !cell.is_null() ||
|
| - Handle<JSArray>::cast(object)->map()->is_observed() ||
|
| - !Handle<JSArray>::cast(object)->map()->is_extensible()) {
|
| - return Handle<Code>::null();
|
| - }
|
| -
|
| - Label miss, return_undefined, call_builtin;
|
| - Register receiver = r0;
|
| - Register scratch = r1;
|
| - Register elements = r3;
|
| -
|
| - HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
|
| -
|
| - // Get the elements array of the object.
|
| - __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset));
|
| -
|
| - // Check that the elements are in fast mode and writable.
|
| - __ CheckMap(elements,
|
| - scratch,
|
| - Heap::kFixedArrayMapRootIndex,
|
| - &call_builtin,
|
| - DONT_DO_SMI_CHECK);
|
| -
|
| - // Get the array's length into r4 and calculate new length.
|
| - __ ldr(r4, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| - __ sub(r4, r4, Operand(Smi::FromInt(1)), SetCC);
|
| - __ b(lt, &return_undefined);
|
| -
|
| - // Get the last element.
|
| - __ LoadRoot(r6, Heap::kTheHoleValueRootIndex);
|
| - // We can't address the last element in one operation. Compute the more
|
| - // expensive shift first, and use an offset later on.
|
| - __ add(elements, elements, Operand::PointerOffsetFromSmiKey(r4));
|
| - __ ldr(scratch, FieldMemOperand(elements, FixedArray::kHeaderSize));
|
| - __ cmp(scratch, r6);
|
| - __ b(eq, &call_builtin);
|
| -
|
| - // Set the array's length.
|
| - __ str(r4, FieldMemOperand(receiver, JSArray::kLengthOffset));
|
| -
|
| - // Fill with the hole.
|
| - __ str(r6, FieldMemOperand(elements, FixedArray::kHeaderSize));
|
| - const int argc = arguments().immediate();
|
| - __ Drop(argc + 1);
|
| - __ mov(r0, scratch);
|
| - __ Ret();
|
| -
|
| - __ bind(&return_undefined);
|
| - __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
|
| - __ Drop(argc + 1);
|
| - __ Ret();
|
| -
|
| - __ bind(&call_builtin);
|
| - __ TailCallExternalReference(
|
| - ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1);
|
| -
|
| - HandlerFrontendFooter(&miss);
|
| -
|
| - // Return the generated code.
|
| - return GetCode(type, name);
|
| -}
|
| -
|
| -
|
| -Handle<Code> CallStubCompiler::CompileFastApiCall(
|
| - const CallOptimization& optimization,
|
| - Handle<Object> object,
|
| - Handle<JSObject> holder,
|
| - Handle<Cell> cell,
|
| - Handle<JSFunction> function,
|
| - Handle<String> name) {
|
| - Counters* counters = isolate()->counters();
|
| -
|
| - ASSERT(optimization.is_simple_api_call());
|
| - // Bail out if object is a global object as we don't want to
|
| - // repatch it to global receiver.
|
| - if (object->IsGlobalObject()) return Handle<Code>::null();
|
| - if (!cell.is_null()) return Handle<Code>::null();
|
| - if (!object->IsJSObject()) return Handle<Code>::null();
|
| - int depth = optimization.GetPrototypeDepthOfExpectedType(
|
| - Handle<JSObject>::cast(object), holder);
|
| - if (depth == kInvalidProtoDepth) return Handle<Code>::null();
|
| -
|
| - Label miss, miss_before_stack_reserved;
|
| - GenerateNameCheck(name, &miss_before_stack_reserved);
|
| -
|
| - // Get the receiver from the stack.
|
| - const int argc = arguments().immediate();
|
| - __ ldr(r1, MemOperand(sp, argc * kPointerSize));
|
| -
|
| - // Check that the receiver isn't a smi.
|
| - __ JumpIfSmi(r1, &miss_before_stack_reserved);
|
| -
|
| - __ IncrementCounter(counters->call_const(), 1, r0, r3);
|
| - __ IncrementCounter(counters->call_const_fast_api(), 1, r0, r3);
|
| -
|
| - ReserveSpaceForFastApiCall(masm(), r0);
|
| -
|
| - // Check that the maps haven't changed and find a Holder as a side effect.
|
| - CheckPrototypes(
|
| - IC::CurrentTypeOf(object, isolate()),
|
| - r1, holder, r0, r3, r4, name, depth, &miss);
|
| -
|
| - GenerateFastApiDirectCall(masm(), optimization, argc, false);
|
| -
|
| - __ bind(&miss);
|
| - FreeSpaceForFastApiCall(masm());
|
| -
|
| - HandlerFrontendFooter(&miss_before_stack_reserved);
|
| -
|
| - // Return the generated code.
|
| - return GetCode(function);
|
| -}
|
| -
|
| -
|
| void StubCompiler::GenerateBooleanCheck(Register object, Label* miss) {
|
| Label success;
|
| // Check that the object is a boolean.
|
| @@ -1953,178 +1221,6 @@ void StubCompiler::GenerateBooleanCheck(Register object, Label* miss) {
|
| }
|
|
|
|
|
| -void CallStubCompiler::PatchImplicitReceiver(Handle<Object> object) {
|
| - if (object->IsGlobalObject()) {
|
| - const int argc = arguments().immediate();
|
| - const int receiver_offset = argc * kPointerSize;
|
| - __ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
|
| - __ str(r3, MemOperand(sp, receiver_offset));
|
| - }
|
| -}
|
| -
|
| -
|
| -Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object,
|
| - Handle<JSObject> holder,
|
| - Handle<Name> name,
|
| - CheckType check,
|
| - Label* miss) {
|
| - // ----------- S t a t e -------------
|
| - // -- r2 : name
|
| - // -- lr : return address
|
| - // -----------------------------------
|
| - GenerateNameCheck(name, miss);
|
| -
|
| - Register reg = r0;
|
| -
|
| - // Get the receiver from the stack
|
| - const int argc = arguments().immediate();
|
| - const int receiver_offset = argc * kPointerSize;
|
| - __ ldr(r0, MemOperand(sp, receiver_offset));
|
| -
|
| - // Check that the receiver isn't a smi.
|
| - if (check != NUMBER_CHECK) {
|
| - __ JumpIfSmi(r0, miss);
|
| - }
|
| -
|
| - // Make sure that it's okay not to patch the on stack receiver
|
| - // unless we're doing a receiver map check.
|
| - ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK);
|
| - switch (check) {
|
| - case RECEIVER_MAP_CHECK:
|
| - __ IncrementCounter(isolate()->counters()->call_const(), 1, r1, r3);
|
| -
|
| - // Check that the maps haven't changed.
|
| - reg = CheckPrototypes(
|
| - IC::CurrentTypeOf(object, isolate()),
|
| - reg, holder, r1, r3, r4, name, miss);
|
| - break;
|
| -
|
| - case STRING_CHECK: {
|
| - // Check that the object is a string.
|
| - __ CompareObjectType(reg, r3, r3, FIRST_NONSTRING_TYPE);
|
| - __ b(ge, miss);
|
| - // Check that the maps starting from the prototype haven't changed.
|
| - GenerateDirectLoadGlobalFunctionPrototype(
|
| - masm(), Context::STRING_FUNCTION_INDEX, r1, miss);
|
| - break;
|
| - }
|
| - case SYMBOL_CHECK: {
|
| - // Check that the object is a symbol.
|
| - __ CompareObjectType(reg, r3, r3, SYMBOL_TYPE);
|
| - __ b(ne, miss);
|
| - // Check that the maps starting from the prototype haven't changed.
|
| - GenerateDirectLoadGlobalFunctionPrototype(
|
| - masm(), Context::SYMBOL_FUNCTION_INDEX, r1, miss);
|
| - break;
|
| - }
|
| - case NUMBER_CHECK: {
|
| - Label fast;
|
| - // Check that the object is a smi or a heap number.
|
| - __ JumpIfSmi(reg, &fast);
|
| - __ CompareObjectType(reg, r3, r3, HEAP_NUMBER_TYPE);
|
| - __ b(ne, miss);
|
| - __ bind(&fast);
|
| - // Check that the maps starting from the prototype haven't changed.
|
| - GenerateDirectLoadGlobalFunctionPrototype(
|
| - masm(), Context::NUMBER_FUNCTION_INDEX, r1, miss);
|
| - break;
|
| - }
|
| - case BOOLEAN_CHECK: {
|
| - GenerateBooleanCheck(reg, miss);
|
| -
|
| - // Check that the maps starting from the prototype haven't changed.
|
| - GenerateDirectLoadGlobalFunctionPrototype(
|
| - masm(), Context::BOOLEAN_FUNCTION_INDEX, r1, miss);
|
| - break;
|
| - }
|
| - }
|
| -
|
| - if (check != RECEIVER_MAP_CHECK) {
|
| - Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
|
| - reg = CheckPrototypes(
|
| - IC::CurrentTypeOf(prototype, isolate()),
|
| - r1, holder, r1, r3, r4, name, miss);
|
| - }
|
| -
|
| - return reg;
|
| -}
|
| -
|
| -
|
| -void CallStubCompiler::GenerateJumpFunction(Handle<Object> object,
|
| - Register function,
|
| - Label* miss) {
|
| - ASSERT(function.is(r1));
|
| - // Check that the function really is a function.
|
| - GenerateFunctionCheck(function, r3, miss);
|
| - PatchImplicitReceiver(object);
|
| -
|
| - // Invoke the function.
|
| - __ InvokeFunction(r1, arguments(), JUMP_FUNCTION, NullCallWrapper());
|
| -}
|
| -
|
| -
|
| -Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object,
|
| - Handle<JSObject> holder,
|
| - Handle<Name> name) {
|
| - Label miss;
|
| - GenerateNameCheck(name, &miss);
|
| -
|
| - // Get the number of arguments.
|
| - const int argc = arguments().immediate();
|
| - LookupResult lookup(isolate());
|
| - LookupPostInterceptor(holder, name, &lookup);
|
| -
|
| - // Get the receiver from the stack.
|
| - __ ldr(r1, MemOperand(sp, argc * kPointerSize));
|
| -
|
| - CallInterceptorCompiler compiler(this, arguments(), r2);
|
| - compiler.Compile(masm(), object, holder, name, &lookup, r1, r3, r4, r0,
|
| - &miss);
|
| -
|
| - // Move returned value, the function to call, to r1.
|
| - __ mov(r1, r0);
|
| - // Restore receiver.
|
| - __ ldr(r0, MemOperand(sp, argc * kPointerSize));
|
| -
|
| - GenerateJumpFunction(object, r1, &miss);
|
| -
|
| - HandlerFrontendFooter(&miss);
|
| -
|
| - // Return the generated code.
|
| - return GetCode(Code::FAST, name);
|
| -}
|
| -
|
| -
|
| -Handle<Code> CallStubCompiler::CompileCallGlobal(
|
| - Handle<JSObject> object,
|
| - Handle<GlobalObject> holder,
|
| - Handle<PropertyCell> cell,
|
| - Handle<JSFunction> function,
|
| - Handle<Name> name) {
|
| - if (HasCustomCallGenerator(function)) {
|
| - Handle<Code> code = CompileCustomCall(
|
| - object, holder, cell, function, Handle<String>::cast(name),
|
| - Code::NORMAL);
|
| - // A null handle means bail out to the regular compiler code below.
|
| - if (!code.is_null()) return code;
|
| - }
|
| -
|
| - Label miss;
|
| - HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
|
| - // Potentially loads a closure that matches the shared function info of the
|
| - // function, rather than function.
|
| - GenerateLoadFunctionFromCell(cell, function, &miss);
|
| -
|
| - Counters* counters = isolate()->counters();
|
| - __ IncrementCounter(counters->call_global_inline(), 1, r3, r4);
|
| - GenerateJumpFunction(object, r1, function);
|
| - HandlerFrontendFooter(&miss);
|
| -
|
| - // Return the generated code.
|
| - return GetCode(Code::NORMAL, name);
|
| -}
|
| -
|
| -
|
| Handle<Code> StoreStubCompiler::CompileStoreCallback(
|
| Handle<JSObject> object,
|
| Handle<JSObject> holder,
|
| @@ -2153,29 +1249,13 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
|
| }
|
|
|
|
|
| -Handle<Code> StoreStubCompiler::CompileStoreCallback(
|
| - Handle<JSObject> object,
|
| - Handle<JSObject> holder,
|
| - Handle<Name> name,
|
| - const CallOptimization& call_optimization) {
|
| - HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
|
| - receiver(), holder, name);
|
| -
|
| - Register values[] = { value() };
|
| - GenerateFastApiCall(
|
| - masm(), call_optimization, receiver(), scratch3(), 1, values);
|
| -
|
| - // Return the generated code.
|
| - return GetCode(kind(), Code::FAST, name);
|
| -}
|
| -
|
| -
|
| #undef __
|
| #define __ ACCESS_MASM(masm)
|
|
|
|
|
| void StoreStubCompiler::GenerateStoreViaSetter(
|
| MacroAssembler* masm,
|
| + Handle<HeapType> type,
|
| Handle<JSFunction> setter) {
|
| // ----------- S t a t e -------------
|
| // -- r0 : value
|
| @@ -2185,13 +1265,21 @@ void StoreStubCompiler::GenerateStoreViaSetter(
|
| // -----------------------------------
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| + Register receiver = r1;
|
| + Register value = r0;
|
|
|
| // Save value register, so we can restore it later.
|
| - __ push(r0);
|
| + __ push(value);
|
|
|
| if (!setter.is_null()) {
|
| // Call the JavaScript setter with receiver and value on the stack.
|
| - __ Push(r1, r0);
|
| + if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
|
| + // Swap in the global receiver.
|
| + __ ldr(receiver,
|
| + FieldMemOperand(
|
| + receiver, JSGlobalObject::kGlobalReceiverOffset));
|
| + }
|
| + __ Push(receiver, value);
|
| ParameterCount actual(1);
|
| ParameterCount expected(setter);
|
| __ InvokeFunction(setter, expected, actual,
|
| @@ -2250,7 +1338,7 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
|
| }
|
|
|
|
|
| -Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
|
| +Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<HeapType> type,
|
| Handle<JSObject> last,
|
| Handle<Name> name) {
|
| NonexistentHandlerFrontend(type, last, name);
|
| @@ -2298,6 +1386,7 @@ Register* KeyedStoreStubCompiler::registers() {
|
|
|
|
|
| void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
|
| + Handle<HeapType> type,
|
| Register receiver,
|
| Handle<JSFunction> getter) {
|
| // ----------- S t a t e -------------
|
| @@ -2310,6 +1399,12 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
|
|
|
| if (!getter.is_null()) {
|
| // Call the JavaScript getter with the receiver on the stack.
|
| + if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
|
| + // Swap in the global receiver.
|
| + __ ldr(receiver,
|
| + FieldMemOperand(
|
| + receiver, JSGlobalObject::kGlobalReceiverOffset));
|
| + }
|
| __ push(receiver);
|
| ParameterCount actual(0);
|
| ParameterCount expected(getter);
|
| @@ -2333,13 +1428,12 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
|
|
|
|
|
| Handle<Code> LoadStubCompiler::CompileLoadGlobal(
|
| - Handle<Type> type,
|
| + Handle<HeapType> type,
|
| Handle<GlobalObject> global,
|
| Handle<PropertyCell> cell,
|
| Handle<Name> name,
|
| bool is_dont_delete) {
|
| Label miss;
|
| -
|
| HandlerFrontendHeader(type, receiver(), global, name, &miss);
|
|
|
| // Get the value from the cell.
|
| @@ -2353,13 +1447,13 @@ Handle<Code> LoadStubCompiler::CompileLoadGlobal(
|
| __ b(eq, &miss);
|
| }
|
|
|
| - HandlerFrontendFooter(name, &miss);
|
| -
|
| Counters* counters = isolate()->counters();
|
| __ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3);
|
| __ mov(r0, r4);
|
| __ Ret();
|
|
|
| + HandlerFrontendFooter(name, &miss);
|
| +
|
| // Return the generated code.
|
| return GetCode(kind(), Code::NORMAL, name);
|
| }
|
| @@ -2389,13 +1483,13 @@ Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
|
| int number_of_handled_maps = 0;
|
| __ ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset));
|
| for (int current = 0; current < receiver_count; ++current) {
|
| - Handle<Type> type = types->at(current);
|
| + Handle<HeapType> type = types->at(current);
|
| Handle<Map> map = IC::TypeToMap(*type, isolate());
|
| if (!map->is_deprecated()) {
|
| number_of_handled_maps++;
|
| __ mov(ip, Operand(map));
|
| __ cmp(map_reg, ip);
|
| - if (type->Is(Type::Number())) {
|
| + if (type->Is(HeapType::Number())) {
|
| ASSERT(!number_case.is_unused());
|
| __ bind(&number_case);
|
| }
|
|
|