X87: Encapsulate the holder in the PropertyHolderCompilers

port r22704.

original commit message:
  Encapsulate the holder in the PropertyHolderCompilers

BUG=
R=weiliang.lin@intel.com

Review URL: https://codereview.chromium.org/435543002

Patch from Chunyang Dai <chunyang.dai@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22747 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 546e8a62
......@@ -417,10 +417,10 @@ void NamedStoreHandlerCompiler::GenerateNegativeHolderLookup(
// Receiver_reg is preserved on jumps to miss_label, but may be destroyed if
// store is successful.
void NamedStoreHandlerCompiler::GenerateStoreTransition(
MacroAssembler* masm, Handle<JSObject> object, LookupResult* lookup,
Handle<Map> transition, Handle<Name> name, Register receiver_reg,
Register storage_reg, Register value_reg, Register scratch1,
Register scratch2, Register unused, Label* miss_label, Label* slow) {
MacroAssembler* masm, LookupResult* lookup, Handle<Map> transition,
Handle<Name> name, Register receiver_reg, Register storage_reg,
Register value_reg, Register scratch1, Register scratch2, Register unused,
Label* miss_label, Label* slow) {
int descriptor = transition->LastAdded();
DescriptorArray* descriptors = transition->instance_descriptors();
PropertyDetails details = descriptors->GetDetails(descriptor);
......@@ -471,13 +471,12 @@ void NamedStoreHandlerCompiler::GenerateStoreTransition(
__ fstp_d(FieldOperand(storage_reg, HeapNumber::kValueOffset));
}
// Stub never generated for non-global objects that require access
// checks.
ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
// Stub never generated for objects that require access checks.
ASSERT(!transition->is_access_check_needed());
// Perform map transition for the receiver if necessary.
if (details.type() == FIELD &&
object->map()->unused_property_fields() == 0) {
Map::cast(transition->GetBackPointer())->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.
__ pop(scratch1); // Return address.
......@@ -517,14 +516,14 @@ void NamedStoreHandlerCompiler::GenerateStoreTransition(
// Adjust for the number of properties stored in the object. Even in the
// face of a transition we can use the old map here because the size of the
// object and the number of in-object properties is not going to change.
index -= object->map()->inobject_properties();
index -= transition->inobject_properties();
SmiCheck smi_check = representation.IsTagged()
? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
// TODO(verwaest): Share this code as a code stub.
if (index < 0) {
// Set the property straight into the object.
int offset = object->map()->instance_size() + (index * kPointerSize);
int offset = transition->instance_size() + (index * kPointerSize);
if (representation.IsDouble()) {
__ mov(FieldOperand(receiver_reg, offset), storage_reg);
} else {
......@@ -692,8 +691,8 @@ void PropertyAccessCompiler::GenerateTailCall(MacroAssembler* masm,
Register PropertyHandlerCompiler::CheckPrototypes(
Register object_reg, Handle<JSObject> holder, Register holder_reg,
Register scratch1, Register scratch2, Handle<Name> name, Label* miss,
Register object_reg, Register holder_reg, Register scratch1,
Register scratch2, Handle<Name> name, Label* miss,
PrototypeCheckType check) {
Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate()));
......@@ -711,7 +710,7 @@ Register PropertyHandlerCompiler::CheckPrototypes(
current = Handle<JSObject>::cast(type()->AsConstant()->Value());
Handle<JSObject> prototype = Handle<JSObject>::null();
Handle<Map> current_map = receiver_map;
Handle<Map> holder_map(holder->map());
Handle<Map> holder_map(holder()->map());
// Traverse the prototype chain and check the maps in the prototype chain for
// fast and global objects or do negative lookup for normal objects.
while (!current_map.is_identical_to(holder_map)) {
......@@ -824,14 +823,14 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = FrontendHeader(object_reg, holder, name, &miss);
Register reg = FrontendHeader(object_reg, name, &miss);
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
if (!holder()->HasFastProperties()) {
ASSERT(!holder()->IsGlobalObject());
ASSERT(!reg.is(scratch2()));
ASSERT(!reg.is(scratch3()));
Register dictionary = scratch1();
......@@ -881,8 +880,7 @@ Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
void NamedLoadHandlerCompiler::GenerateLoadField(
Register reg, Handle<JSObject> holder, FieldIndex field,
Representation representation) {
Register reg, FieldIndex field, Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), reg);
LoadFieldStub stub(isolate(), field);
GenerateTailCall(masm(), stub.GetCode());
......@@ -941,11 +939,11 @@ void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
}
void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
Register holder_reg, Handle<JSObject> interceptor_holder,
LookupResult* lookup, Handle<Name> name) {
ASSERT(interceptor_holder->HasNamedInterceptor());
ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined());
void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg,
LookupResult* lookup,
Handle<Name> name) {
ASSERT(holder()->HasNamedInterceptor());
ASSERT(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
// So far the most popular follow ups for interceptor loads are FIELD
// and CALLBACKS, so inline only them, other cases may be added
......@@ -975,7 +973,7 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
// the holder and it is needed should the interceptor return without any
// result. The CALLBACKS case needs the receiver to be passed into C++ code,
// the FIELD case might cause a miss during the prototype check.
bool must_perfrom_prototype_check = *interceptor_holder != lookup->holder();
bool must_perfrom_prototype_check = *holder() != lookup->holder();
bool must_preserve_receiver_reg = !receiver().is(holder_reg) &&
(lookup->type() == CALLBACKS || must_perfrom_prototype_check);
......@@ -994,7 +992,7 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
// interceptor's holder has been compiled before (see a caller
// of this method.)
CompileCallLoadPropertyWithInterceptor(
masm(), receiver(), holder_reg, this->name(), interceptor_holder,
masm(), receiver(), holder_reg, this->name(), holder(),
IC::kLoadPropertyWithInterceptorOnly);
// Check if interceptor provided a value for property. If it's
......@@ -1022,13 +1020,13 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
// Leave the internal frame.
}
GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup);
GenerateLoadPostInterceptor(holder_reg, name, lookup);
} else { // !compile_followup_inline
// Call the runtime system to load the interceptor.
// Check that the maps haven't changed.
__ pop(scratch2()); // save old return address
PushInterceptorArguments(masm(), receiver(), holder_reg,
this->name(), interceptor_holder);
PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
holder());
__ push(scratch2()); // restore old return address
ExternalReference ref =
......@@ -1041,9 +1039,9 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
Handle<JSObject> object, Handle<JSObject> holder, Handle<Name> name,
Handle<JSObject> object, Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
Register holder_reg = Frontend(receiver(), holder, name);
Register holder_reg = Frontend(receiver(), name);
__ pop(scratch1()); // remove the return address
__ push(receiver());
......@@ -1113,7 +1111,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
Handle<JSObject> object, Handle<Name> name) {
Handle<Name> name) {
__ pop(scratch1()); // remove the return address
__ push(receiver());
__ push(this->name());
......@@ -1171,8 +1169,8 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
Handle<JSObject> last, Handle<Name> name) {
NonexistentFrontend(last, name);
Handle<Name> name) {
NonexistentFrontend(name);
// Return undefined if maps of the full prototype chain are still the
// same and no global property with this name contains a value.
......@@ -1255,11 +1253,10 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
Handle<GlobalObject> global, Handle<PropertyCell> cell, Handle<Name> name,
bool is_dont_delete) {
Handle<PropertyCell> cell, Handle<Name> name, bool is_dont_delete) {
Label miss;
FrontendHeader(receiver(), global, name, &miss);
FrontendHeader(receiver(), name, &miss);
// Get the value from the cell.
Register result = StoreIC::ValueRegister();
if (masm()->serializer_enabled()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment