X87: Encapsulate type in the PropertyHandlerCompiler
authorweiliang.lin@intel.com <weiliang.lin@intel.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 31 Jul 2014 09:01:32 +0000 (09:01 +0000)
committerweiliang.lin@intel.com <weiliang.lin@intel.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 31 Jul 2014 09:01:32 +0000 (09:01 +0000)
port r22700.

original commit message:
  Encapsulate type in the PropertyHandlerCompiler

BUG=
R=weiliang.lin@intel.com

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

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22741 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/x87/stub-cache-x87.cc

index f351d62ebe4fc375d90e4aa03a4346056059e331..75137d5133dee0b77640f3f8d2113de5442ed779 100644 (file)
@@ -692,10 +692,10 @@ void PropertyAccessCompiler::GenerateTailCall(MacroAssembler* masm,
 
 
 Register PropertyHandlerCompiler::CheckPrototypes(
-    Handle<HeapType> type, Register object_reg, Handle<JSObject> holder,
-    Register holder_reg, Register scratch1, Register scratch2,
-    Handle<Name> name, Label* miss, PrototypeCheckType check) {
-  Handle<Map> receiver_map(IC::TypeToMap(*type, isolate()));
+    Register object_reg, Handle<JSObject> holder, Register holder_reg,
+    Register scratch1, Register scratch2, Handle<Name> name, Label* miss,
+    PrototypeCheckType check) {
+  Handle<Map> receiver_map(IC::TypeToMap(*type(), isolate()));
 
   // Make sure there's no overlap between holder and object registers.
   ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
@@ -707,8 +707,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
   int depth = 0;
 
   Handle<JSObject> current = Handle<JSObject>::null();
-  if (type->IsConstant()) current =
-      Handle<JSObject>::cast(type->AsConstant()->Value());
+  if (type()->IsConstant())
+    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());
@@ -823,14 +823,13 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
 }
 
 
-Register NamedLoadHandlerCompiler::CallbackFrontend(Handle<HeapType> type,
-                                                    Register object_reg,
+Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
                                                     Handle<JSObject> holder,
                                                     Handle<Name> name,
                                                     Handle<Object> callback) {
   Label miss;
 
-  Register reg = FrontendHeader(type, object_reg, holder, name, &miss);
+  Register reg = FrontendHeader(object_reg, holder, name, &miss);
 
   if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
     ASSERT(!reg.is(scratch2()));
@@ -943,9 +942,8 @@ void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
 
 
 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
-    Register holder_reg, Handle<Object> object,
-    Handle<JSObject> interceptor_holder, LookupResult* lookup,
-    Handle<Name> name) {
+    Register holder_reg, Handle<JSObject> interceptor_holder,
+    LookupResult* lookup, Handle<Name> name) {
   ASSERT(interceptor_holder->HasNamedInterceptor());
   ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined());
 
@@ -958,10 +956,12 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
       compile_followup_inline = true;
     } else if (lookup->type() == CALLBACKS &&
                lookup->GetCallbackObject()->IsExecutableAccessorInfo()) {
-      ExecutableAccessorInfo* callback =
-          ExecutableAccessorInfo::cast(lookup->GetCallbackObject());
-      compile_followup_inline = callback->getter() != NULL &&
-          callback->IsCompatibleReceiver(*object);
+      Handle<ExecutableAccessorInfo> callback(
+          ExecutableAccessorInfo::cast(lookup->GetCallbackObject()));
+      compile_followup_inline =
+          callback->getter() != NULL &&
+          ExecutableAccessorInfo::IsCompatibleReceiverType(isolate(), callback,
+                                                           type());
     }
   }
 
@@ -1043,8 +1043,7 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(
 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
     Handle<JSObject> object, Handle<JSObject> holder, Handle<Name> name,
     Handle<ExecutableAccessorInfo> callback) {
-  Register holder_reg =
-      Frontend(IC::CurrentTypeOf(object, isolate()), receiver(), holder, name);
+  Register holder_reg = Frontend(receiver(), holder, name);
 
   __ pop(scratch1());  // remove the return address
   __ push(receiver());
@@ -1172,8 +1171,8 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
 
 
 Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
-    Handle<HeapType> type, Handle<JSObject> last, Handle<Name> name) {
-  NonexistentFrontend(type, last, name);
+    Handle<JSObject> last, Handle<Name> name) {
+  NonexistentFrontend(last, name);
 
   // Return undefined if maps of the full prototype chain are still the
   // same and no global property with this name contains a value.
@@ -1256,25 +1255,26 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
 
 
 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal(
-    Handle<HeapType> type, Handle<GlobalObject> global,
-    Handle<PropertyCell> cell, Handle<Name> name, bool is_dont_delete) {
+    Handle<GlobalObject> global, Handle<PropertyCell> cell, Handle<Name> name,
+    bool is_dont_delete) {
   Label miss;
 
-  FrontendHeader(type, receiver(), global, name, &miss);
+  FrontendHeader(receiver(), global, name, &miss);
   // Get the value from the cell.
+  Register result = StoreIC::ValueRegister();
   if (masm()->serializer_enabled()) {
-    __ mov(eax, Immediate(cell));
-    __ mov(eax, FieldOperand(eax, PropertyCell::kValueOffset));
+    __ mov(result, Immediate(cell));
+    __ mov(result, FieldOperand(result, PropertyCell::kValueOffset));
   } else {
-    __ mov(eax, Operand::ForCell(cell));
+    __ mov(result, Operand::ForCell(cell));
   }
 
   // Check for deleted property if property can actually be deleted.
   if (!is_dont_delete) {
-    __ cmp(eax, factory()->the_hole_value());
+    __ cmp(result, factory()->the_hole_value());
     __ j(equal, &miss);
   } else if (FLAG_debug_code) {
-    __ cmp(eax, factory()->the_hole_value());
+    __ cmp(result, factory()->the_hole_value());
     __ Check(not_equal, kDontDeleteCellsCannotContainTheHole);
   }