summaryrefslogtreecommitdiff
path: root/deps/v8/src/ic/mips/handler-compiler-mips.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/ic/mips/handler-compiler-mips.cc')
-rw-r--r--deps/v8/src/ic/mips/handler-compiler-mips.cc172
1 files changed, 37 insertions, 135 deletions
diff --git a/deps/v8/src/ic/mips/handler-compiler-mips.cc b/deps/v8/src/ic/mips/handler-compiler-mips.cc
index b924bdad78..f4e0f0baba 100644
--- a/deps/v8/src/ic/mips/handler-compiler-mips.cc
+++ b/deps/v8/src/ic/mips/handler-compiler-mips.cc
@@ -195,9 +195,11 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
void PropertyHandlerCompiler::GenerateCheckPropertyCell(
MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name,
Register scratch, Label* miss) {
- Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
- DCHECK(cell->value()->IsTheHole());
- Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell);
+ Handle<PropertyCell> cell = JSGlobalObject::EnsureEmptyPropertyCell(
+ global, name, PropertyCellType::kInvalidated);
+ Isolate* isolate = masm->isolate();
+ DCHECK(cell->value()->IsTheHole(isolate));
+ Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(cell);
__ LoadWeakValue(scratch, weak_cell, miss);
__ lw(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset));
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
@@ -279,7 +281,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
bool call_data_undefined = false;
// Put call data in place.
- if (api_call_info->data()->IsUndefined()) {
+ if (api_call_info->data()->IsUndefined(isolate)) {
call_data_undefined = true;
__ LoadRoot(data, Heap::kUndefinedValueRootIndex);
} else {
@@ -319,17 +321,8 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
StoreDescriptor::ValueRegister(),
- VectorStoreICDescriptor::SlotRegister(),
- VectorStoreICDescriptor::VectorRegister());
-}
-
-
-void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
- StoreIC_PushArgs(masm);
-
- // The slow case calls into the runtime to complete the store without causing
- // an IC miss that would otherwise cause a transition to the generic stub.
- __ TailCallRuntime(Runtime::kStoreIC_Slow);
+ StoreWithVectorDescriptor::SlotRegister(),
+ StoreWithVectorDescriptor::VectorRegister());
}
@@ -423,28 +416,25 @@ Register PropertyHandlerCompiler::CheckPrototypes(
DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) &&
!scratch2.is(scratch1));
- if (FLAG_eliminate_prototype_chain_checks) {
- Handle<Cell> validity_cell =
- Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate());
- if (!validity_cell.is_null()) {
- DCHECK_EQ(Smi::FromInt(Map::kPrototypeChainValid),
- validity_cell->value());
- __ li(scratch1, Operand(validity_cell));
- __ lw(scratch1, FieldMemOperand(scratch1, Cell::kValueOffset));
- __ Branch(miss, ne, scratch1,
- Operand(Smi::FromInt(Map::kPrototypeChainValid)));
- }
+ Handle<Cell> validity_cell =
+ Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate());
+ if (!validity_cell.is_null()) {
+ DCHECK_EQ(Smi::FromInt(Map::kPrototypeChainValid), validity_cell->value());
+ __ li(scratch1, Operand(validity_cell));
+ __ lw(scratch1, FieldMemOperand(scratch1, Cell::kValueOffset));
+ __ Branch(miss, ne, scratch1,
+ Operand(Smi::FromInt(Map::kPrototypeChainValid)));
+ }
- // The prototype chain of primitives (and their JSValue wrappers) depends
- // on the native context, which can't be guarded by validity cells.
- // |object_reg| holds the native context specific prototype in this case;
- // we need to check its map.
- if (check == CHECK_ALL_MAPS) {
- __ lw(scratch1, FieldMemOperand(object_reg, HeapObject::kMapOffset));
- Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
- __ GetWeakValue(scratch2, cell);
- __ Branch(miss, ne, scratch1, Operand(scratch2));
- }
+ // The prototype chain of primitives (and their JSValue wrappers) depends
+ // on the native context, which can't be guarded by validity cells.
+ // |object_reg| holds the native context specific prototype in this case;
+ // we need to check its map.
+ if (check == CHECK_ALL_MAPS) {
+ __ lw(scratch1, FieldMemOperand(object_reg, HeapObject::kMapOffset));
+ Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
+ __ GetWeakValue(scratch2, cell);
+ __ Branch(miss, ne, scratch1, Operand(scratch2));
}
// Keep track of the current object in register reg.
@@ -480,8 +470,10 @@ Register PropertyHandlerCompiler::CheckPrototypes(
!current_map->is_access_check_needed());
prototype = handle(JSObject::cast(current_map->prototype()));
- if (current_map->is_dictionary_map() &&
- !current_map->IsJSGlobalObjectMap()) {
+ if (current_map->IsJSGlobalObjectMap()) {
+ GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
+ name, scratch2, miss);
+ } else if (current_map->is_dictionary_map()) {
DCHECK(!current_map->IsJSGlobalProxyMap()); // Proxy maps are fast.
if (!name->IsUniqueName()) {
DCHECK(name->IsString());
@@ -491,33 +483,12 @@ Register PropertyHandlerCompiler::CheckPrototypes(
current->property_dictionary()->FindEntry(name) ==
NameDictionary::kNotFound);
- if (FLAG_eliminate_prototype_chain_checks && depth > 1) {
+ if (depth > 1) {
// TODO(jkummerow): Cache and re-use weak cell.
__ LoadWeakValue(reg, isolate()->factory()->NewWeakCell(current), miss);
}
GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1,
scratch2);
- if (!FLAG_eliminate_prototype_chain_checks) {
- __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
- __ lw(holder_reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
- }
- } else {
- Register map_reg = scratch1;
- if (!FLAG_eliminate_prototype_chain_checks) {
- __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
- }
- if (current_map->IsJSGlobalObjectMap()) {
- GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
- name, scratch2, miss);
- } else if (!FLAG_eliminate_prototype_chain_checks &&
- (depth != 1 || check == CHECK_ALL_MAPS)) {
- Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
- __ GetWeakValue(scratch2, cell);
- __ Branch(miss, ne, scratch2, Operand(map_reg));
- }
- if (!FLAG_eliminate_prototype_chain_checks) {
- __ lw(holder_reg, FieldMemOperand(map_reg, Map::kPrototypeOffset));
- }
}
reg = holder_reg; // From now on the object will be in holder_reg.
@@ -531,17 +502,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
// Log the check depth.
LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
- if (!FLAG_eliminate_prototype_chain_checks &&
- (depth != 0 || check == CHECK_ALL_MAPS)) {
- // Check the holder map.
- __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
- Handle<WeakCell> cell = Map::WeakCellForMap(current_map);
- __ GetWeakValue(scratch2, cell);
- __ Branch(miss, ne, scratch2, Operand(scratch1));
- }
-
bool return_holder = return_what == RETURN_HOLDER;
- if (FLAG_eliminate_prototype_chain_checks && return_holder && depth != 0) {
+ if (return_holder && depth != 0) {
__ LoadWeakValue(reg, isolate()->factory()->NewWeakCell(current), miss);
}
@@ -584,70 +546,10 @@ void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
}
-void NamedLoadHandlerCompiler::GenerateLoadCallback(
- Register reg, Handle<AccessorInfo> callback) {
- DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver()));
- DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
-
- // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
- // name below the exit frame to make GC aware of them.
- STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
- STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
- STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
- STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
- STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
- STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
- STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
- STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
-
- // Here and below +1 is for name() pushed after the args_ array.
- typedef PropertyCallbackArguments PCA;
- __ Subu(sp, sp, (PCA::kArgsLength + 1) * kPointerSize);
- __ sw(receiver(), MemOperand(sp, (PCA::kThisIndex + 1) * kPointerSize));
- Handle<Object> data(callback->data(), isolate());
- if (data->IsUndefined() || data->IsSmi()) {
- __ li(scratch2(), data);
- } else {
- Handle<WeakCell> cell =
- isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
- // The callback is alive if this instruction is executed,
- // so the weak cell is not cleared and points to data.
- __ GetWeakValue(scratch2(), cell);
- }
- __ sw(scratch2(), MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize));
- __ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex);
- __ sw(scratch2(),
- MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize));
- __ sw(scratch2(), MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) *
- kPointerSize));
- __ li(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
- __ sw(scratch2(), MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize));
- __ sw(reg, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize));
- // should_throw_on_error -> false
- DCHECK(Smi::FromInt(0) == nullptr);
- __ sw(zero_reg,
- MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize));
-
- __ sw(name(), MemOperand(sp, 0 * kPointerSize));
-
- // Abi for CallApiGetter.
- Register getter_address_reg = ApiGetterDescriptor::function_address();
-
- 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());
- __ li(getter_address_reg, Operand(ref));
-
- CallApiGetterStub stub(isolate());
- __ TailCallStub(&stub);
-}
-
-
void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
LookupIterator* it, Register holder_reg) {
DCHECK(holder()->HasNamedInterceptor());
- DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
+ DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate()));
// Compile the interceptor call, followed by inline code to load the
// property from further up the prototype chain if the call fails.
@@ -706,7 +608,7 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
// Call the runtime system to load the interceptor.
DCHECK(holder()->HasNamedInterceptor());
- DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
+ DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate()));
PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
holder());
@@ -722,7 +624,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
__ Push(receiver(), holder_reg); // Receiver.
// If the callback cannot leak, then push the callback directly,
// otherwise wrap it in a weak cell.
- if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
+ if (callback->data()->IsUndefined(isolate()) || callback->data()->IsSmi()) {
__ li(at, Operand(callback));
} else {
Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
@@ -737,7 +639,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
__ TailCallRuntime(Runtime::kStoreCallbackProperty);
// Return the generated code.
- return GetCode(kind(), Code::FAST, name);
+ return GetCode(kind(), name);
}
@@ -778,7 +680,7 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
FrontendFooter(name, &miss);
// Return the generated code.
- return GetCode(kind(), Code::NORMAL, name);
+ return GetCode(kind(), name);
}