| Index: src/arm/stub-cache-arm.cc
|
| diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc
|
| index 3595b5233f1572c938d6b2e81659375c6f8cfeb0..21cb80241d6795a361cc916f9e1e52d49eb1163b 100644
|
| --- a/src/arm/stub-cache-arm.cc
|
| +++ b/src/arm/stub-cache-arm.cc
|
| @@ -427,12 +427,10 @@ static void GenerateCheckPropertyCell(MacroAssembler* masm,
|
| Handle<Name> name,
|
| Register scratch,
|
| Label* miss) {
|
| - Handle<JSGlobalPropertyCell> cell =
|
| - GlobalObject::EnsurePropertyCell(global, name);
|
| + Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name);
|
| ASSERT(cell->value()->IsTheHole());
|
| __ mov(scratch, Operand(cell));
|
| - __ ldr(scratch,
|
| - FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
|
| + __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
|
| __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
|
| __ cmp(scratch, ip);
|
| __ b(ne, miss);
|
| @@ -514,7 +512,13 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
|
|
|
| Register storage_reg = name_reg;
|
|
|
| - if (FLAG_track_fields && representation.IsSmi()) {
|
| + if (details.type() == CONSTANT_FUNCTION) {
|
| + Handle<HeapObject> constant(
|
| + HeapObject::cast(descriptors->GetValue(descriptor)));
|
| + __ LoadHeapObject(scratch1, constant);
|
| + __ cmp(value_reg, scratch1);
|
| + __ b(ne, miss_restore_name);
|
| + } else if (FLAG_track_fields && representation.IsSmi()) {
|
| __ JumpIfNotSmi(value_reg, miss_restore_name);
|
| } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
|
| __ JumpIfSmi(value_reg, miss_restore_name);
|
| @@ -543,7 +547,8 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
|
| ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
|
|
|
| // Perform map transition for the receiver if necessary.
|
| - if (object->map()->unused_property_fields() == 0) {
|
| + if (details.type() == FIELD &&
|
| + object->map()->unused_property_fields() == 0) {
|
| // The properties must be extended before we can store the value.
|
| // We jump to a runtime call that extends the properties array.
|
| __ push(receiver_reg);
|
| @@ -572,6 +577,12 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
|
| OMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
|
|
| + if (details.type() == CONSTANT_FUNCTION) {
|
| + ASSERT(value_reg.is(r0));
|
| + __ Ret();
|
| + return;
|
| + }
|
| +
|
| int index = transition->instance_descriptors()->GetFieldIndex(
|
| transition->LastAdded());
|
|
|
| @@ -958,8 +969,22 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm,
|
| ExternalReference ref = ExternalReference(&fun,
|
| type,
|
| masm->isolate());
|
| + Address thunk_address = returns_handle
|
| + ? FUNCTION_ADDR(&InvokeInvocationCallback)
|
| + : FUNCTION_ADDR(&InvokeFunctionCallback);
|
| + ExternalReference::Type thunk_type =
|
| + returns_handle ?
|
| + ExternalReference::PROFILING_API_CALL :
|
| + ExternalReference::PROFILING_API_CALL_NEW;
|
| + ApiFunction thunk_fun(thunk_address);
|
| + ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
|
| + masm->isolate());
|
| +
|
| AllowExternalCallThatCantCauseGC scope(masm);
|
| __ CallApiFunctionAndReturn(ref,
|
| + function_address,
|
| + thunk_ref,
|
| + r1,
|
| kStackUnwindSpace,
|
| returns_handle,
|
| kFastApiCallArguments + 1);
|
| @@ -1456,14 +1481,28 @@ void BaseLoadStubCompiler::GenerateLoadCallback(
|
| Address getter_address = v8::ToCData<Address>(callback->getter());
|
| bool returns_handle =
|
| !CallbackTable::ReturnsVoid(isolate(), getter_address);
|
| +
|
| ApiFunction fun(getter_address);
|
| ExternalReference::Type type =
|
| returns_handle ?
|
| ExternalReference::DIRECT_GETTER_CALL :
|
| ExternalReference::DIRECT_GETTER_CALL_NEW;
|
| -
|
| ExternalReference ref = ExternalReference(&fun, type, isolate());
|
| +
|
| + Address thunk_address = returns_handle
|
| + ? FUNCTION_ADDR(&InvokeAccessorGetter)
|
| + : FUNCTION_ADDR(&InvokeAccessorGetterCallback);
|
| + ExternalReference::Type thunk_type =
|
| + returns_handle ?
|
| + ExternalReference::PROFILING_GETTER_CALL :
|
| + ExternalReference::PROFILING_GETTER_CALL_NEW;
|
| + ApiFunction thunk_fun(thunk_address);
|
| + ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
|
| + isolate());
|
| __ CallApiFunctionAndReturn(ref,
|
| + getter_address,
|
| + thunk_ref,
|
| + r2,
|
| kStackUnwindSpace,
|
| returns_handle,
|
| 5);
|
| @@ -1586,12 +1625,12 @@ void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject> object,
|
|
|
|
|
| void CallStubCompiler::GenerateLoadFunctionFromCell(
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| Label* miss) {
|
| // Get the value from the cell.
|
| __ mov(r3, Operand(cell));
|
| - __ ldr(r1, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset));
|
| + __ ldr(r1, FieldMemOperand(r3, Cell::kValueOffset));
|
|
|
| // Check that the cell contains the same function.
|
| if (heap()->InNewSpace(*function)) {
|
| @@ -1659,12 +1698,61 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
|
| }
|
|
|
|
|
| +Handle<Code> CallStubCompiler::CompileArrayCodeCall(
|
| + Handle<Object> object,
|
| + Handle<JSObject> holder,
|
| + Handle<Cell> cell,
|
| + Handle<JSFunction> function,
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| + Label miss;
|
| +
|
| + // Check that function is still array
|
| + const int argc = arguments().immediate();
|
| + GenerateNameCheck(name, &miss);
|
| + Register receiver = r1;
|
| +
|
| + if (cell.is_null()) {
|
| + __ ldr(receiver, MemOperand(sp, argc * kPointerSize));
|
| +
|
| + // Check that the receiver isn't a smi.
|
| + __ JumpIfSmi(receiver, &miss);
|
| +
|
| + // Check that the maps haven't changed.
|
| + CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, r3, r0,
|
| + r4, name, &miss);
|
| + } else {
|
| + ASSERT(cell->value() == *function);
|
| + GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
|
| + &miss);
|
| + GenerateLoadFunctionFromCell(cell, function, &miss);
|
| + }
|
| +
|
| + Handle<Smi> kind(Smi::FromInt(GetInitialFastElementsKind()), isolate());
|
| + Handle<Cell> kind_feedback_cell =
|
| + isolate()->factory()->NewCell(kind);
|
| + __ mov(r0, Operand(argc));
|
| + __ mov(r2, Operand(kind_feedback_cell));
|
| + __ mov(r1, Operand(function));
|
| +
|
| + ArrayConstructorStub stub(isolate());
|
| + __ TailCallStub(&stub);
|
| +
|
| + __ bind(&miss);
|
| + GenerateMissBranch();
|
| +
|
| + // Return the generated code.
|
| + return GetCode(type, name);
|
| +}
|
| +
|
| +
|
| Handle<Code> CallStubCompiler::CompileArrayPushCall(
|
| Handle<Object> object,
|
| Handle<JSObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| - Handle<String> name) {
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| // ----------- S t a t e -------------
|
| // -- r2 : name
|
| // -- lr : return address
|
| @@ -1908,16 +1996,17 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall(
|
| GenerateMissBranch();
|
|
|
| // Return the generated code.
|
| - return GetCode(function);
|
| + return GetCode(type, name);
|
| }
|
|
|
|
|
| Handle<Code> CallStubCompiler::CompileArrayPopCall(
|
| Handle<Object> object,
|
| Handle<JSObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| - Handle<String> name) {
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| // ----------- S t a t e -------------
|
| // -- r2 : name
|
| // -- lr : return address
|
| @@ -1990,16 +2079,17 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall(
|
| GenerateMissBranch();
|
|
|
| // Return the generated code.
|
| - return GetCode(function);
|
| + return GetCode(type, name);
|
| }
|
|
|
|
|
| Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
|
| Handle<Object> object,
|
| Handle<JSObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| - Handle<String> name) {
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| // ----------- S t a t e -------------
|
| // -- r2 : function name
|
| // -- lr : return address
|
| @@ -2072,16 +2162,17 @@ Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
|
| GenerateMissBranch();
|
|
|
| // Return the generated code.
|
| - return GetCode(function);
|
| + return GetCode(type, name);
|
| }
|
|
|
|
|
| Handle<Code> CallStubCompiler::CompileStringCharAtCall(
|
| Handle<Object> object,
|
| Handle<JSObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| - Handle<String> name) {
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| // ----------- S t a t e -------------
|
| // -- r2 : function name
|
| // -- lr : return address
|
| @@ -2155,16 +2246,17 @@ Handle<Code> CallStubCompiler::CompileStringCharAtCall(
|
| GenerateMissBranch();
|
|
|
| // Return the generated code.
|
| - return GetCode(function);
|
| + return GetCode(type, name);
|
| }
|
|
|
|
|
| Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
|
| Handle<Object> object,
|
| Handle<JSObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| - Handle<String> name) {
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| // ----------- S t a t e -------------
|
| // -- r2 : function name
|
| // -- lr : return address
|
| @@ -2227,16 +2319,17 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
|
| GenerateMissBranch();
|
|
|
| // Return the generated code.
|
| - return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
|
| + return GetCode(type, name);
|
| }
|
|
|
|
|
| Handle<Code> CallStubCompiler::CompileMathFloorCall(
|
| Handle<Object> object,
|
| Handle<JSObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| - Handle<String> name) {
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| // ----------- S t a t e -------------
|
| // -- r2 : function name
|
| // -- lr : return address
|
| @@ -2335,16 +2428,17 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall(
|
| GenerateMissBranch();
|
|
|
| // Return the generated code.
|
| - return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
|
| + return GetCode(type, name);
|
| }
|
|
|
|
|
| Handle<Code> CallStubCompiler::CompileMathAbsCall(
|
| Handle<Object> object,
|
| Handle<JSObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| - Handle<String> name) {
|
| + Handle<String> name,
|
| + Code::StubType type) {
|
| // ----------- S t a t e -------------
|
| // -- r2 : function name
|
| // -- lr : return address
|
| @@ -2433,7 +2527,7 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall(
|
| GenerateMissBranch();
|
|
|
| // Return the generated code.
|
| - return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
|
| + return GetCode(type, name);
|
| }
|
|
|
|
|
| @@ -2441,7 +2535,7 @@ Handle<Code> CallStubCompiler::CompileFastApiCall(
|
| const CallOptimization& optimization,
|
| Handle<Object> object,
|
| Handle<JSObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<Cell> cell,
|
| Handle<JSFunction> function,
|
| Handle<String> name) {
|
| Counters* counters = isolate()->counters();
|
| @@ -2613,8 +2707,9 @@ Handle<Code> CallStubCompiler::CompileCallConstant(
|
| Handle<JSFunction> function) {
|
| if (HasCustomCallGenerator(function)) {
|
| Handle<Code> code = CompileCustomCall(object, holder,
|
| - Handle<JSGlobalPropertyCell>::null(),
|
| - function, Handle<String>::cast(name));
|
| + Handle<Cell>::null(),
|
| + function, Handle<String>::cast(name),
|
| + Code::CONSTANT_FUNCTION);
|
| // A null handle means bail out to the regular compiler code below.
|
| if (!code.is_null()) return code;
|
| }
|
| @@ -2671,7 +2766,7 @@ Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object,
|
| Handle<Code> CallStubCompiler::CompileCallGlobal(
|
| Handle<JSObject> object,
|
| Handle<GlobalObject> holder,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<PropertyCell> cell,
|
| Handle<JSFunction> function,
|
| Handle<Name> name) {
|
| // ----------- S t a t e -------------
|
| @@ -2680,7 +2775,8 @@ Handle<Code> CallStubCompiler::CompileCallGlobal(
|
| // -----------------------------------
|
| if (HasCustomCallGenerator(function)) {
|
| Handle<Code> code = CompileCustomCall(
|
| - object, holder, cell, function, Handle<String>::cast(name));
|
| + 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;
|
| }
|
| @@ -2844,7 +2940,7 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
|
|
|
| Handle<Code> StoreStubCompiler::CompileStoreGlobal(
|
| Handle<GlobalObject> object,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<PropertyCell> cell,
|
| Handle<Name> name) {
|
| Label miss;
|
|
|
| @@ -2859,14 +2955,12 @@ Handle<Code> StoreStubCompiler::CompileStoreGlobal(
|
| // global object. We bail out to the runtime system to do that.
|
| __ mov(scratch1(), Operand(cell));
|
| __ LoadRoot(scratch2(), Heap::kTheHoleValueRootIndex);
|
| - __ ldr(scratch3(),
|
| - FieldMemOperand(scratch1(), JSGlobalPropertyCell::kValueOffset));
|
| + __ ldr(scratch3(), FieldMemOperand(scratch1(), Cell::kValueOffset));
|
| __ cmp(scratch3(), scratch2());
|
| __ b(eq, &miss);
|
|
|
| // Store the value in the cell.
|
| - __ str(value(),
|
| - FieldMemOperand(scratch1(), JSGlobalPropertyCell::kValueOffset));
|
| + __ str(value(), FieldMemOperand(scratch1(), Cell::kValueOffset));
|
| // Cells are always rescanned, so no write barrier here.
|
|
|
| Counters* counters = isolate()->counters();
|
| @@ -2990,7 +3084,7 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
|
| Handle<Code> LoadStubCompiler::CompileLoadGlobal(
|
| Handle<JSObject> object,
|
| Handle<GlobalObject> global,
|
| - Handle<JSGlobalPropertyCell> cell,
|
| + Handle<PropertyCell> cell,
|
| Handle<Name> name,
|
| bool is_dont_delete) {
|
| Label success, miss;
|
| @@ -3002,7 +3096,7 @@ Handle<Code> LoadStubCompiler::CompileLoadGlobal(
|
|
|
| // Get the value from the cell.
|
| __ mov(r3, Operand(cell));
|
| - __ ldr(r4, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset));
|
| + __ ldr(r4, FieldMemOperand(r3, Cell::kValueOffset));
|
|
|
| // Check for deleted property if property can actually be deleted.
|
| if (!is_dont_delete) {
|
|
|