Revert "Unify calling to GenerateFastApiCallBody before stubbing it"

This reverts commit r18714 for breaking webkit tests with an assert.

TBR=dcarney@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18720 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0d906a8b
This diff is collapsed.
This diff is collapsed.
...@@ -1994,45 +1994,20 @@ CallOptimization::CallOptimization(Handle<JSFunction> function) { ...@@ -1994,45 +1994,20 @@ CallOptimization::CallOptimization(Handle<JSFunction> function) {
} }
Handle<Map> CallOptimization::LookupHolderOfExpectedType( int CallOptimization::GetPrototypeDepthOfExpectedType(
Handle<JSObject> receiver,
Handle<JSObject> object, Handle<JSObject> object,
Handle<JSObject> holder, Handle<JSObject> holder) const {
HolderLookup* holder_lookup) const {
ASSERT(is_simple_api_call()); ASSERT(is_simple_api_call());
ASSERT_EQ(kHolderNotFound, *holder_lookup); if (expected_receiver_type_.is_null()) return 0;
*holder_lookup = kHolderIsReceiver; int depth = 0;
Handle<Map> map_to_holder;
if (expected_receiver_type_.is_null()) {
// no expected type, load from receiver.
return map_to_holder;
}
// walk down the prototype chain to the object
while (!receiver.is_identical_to(object)) {
*holder_lookup = kHolderIsPrototypeOfMap;
map_to_holder = Handle<Map>(receiver->map());
receiver = Handle<JSObject>(JSObject::cast(map_to_holder->prototype()));
ASSERT(!expected_receiver_type_->IsTemplateFor(*map_to_holder));
}
// start looking for the holder
while (!object.is_identical_to(holder)) { while (!object.is_identical_to(holder)) {
Handle<Map> object_map(object->map()); if (expected_receiver_type_->IsTemplateFor(object->map())) return depth;
if (expected_receiver_type_->IsTemplateFor(*object_map)) { object = Handle<JSObject>(JSObject::cast(object->GetPrototype()));
return map_to_holder; if (!object->map()->is_hidden_prototype()) return kInvalidProtoDepth;
} ++depth;
if (!object_map->is_hidden_prototype()) {
*holder_lookup = kHolderNotFound;
return Handle<Map>::null();
}
*holder_lookup = kHolderIsPrototypeOfMap;
map_to_holder = object_map;
object = Handle<JSObject>(JSObject::cast(object_map->prototype()));
}
if (expected_receiver_type_->IsTemplateFor(holder->map())) {
return map_to_holder;
} }
*holder_lookup = kHolderNotFound; if (expected_receiver_type_->IsTemplateFor(holder->map())) return depth;
return Handle<Map>::null(); return kInvalidProtoDepth;
} }
......
...@@ -483,6 +483,20 @@ class StubCompiler BASE_EMBEDDED { ...@@ -483,6 +483,20 @@ class StubCompiler BASE_EMBEDDED {
Register scratch2, Register scratch2,
Handle<Name> name, Handle<Name> name,
Label* miss, Label* miss,
PrototypeCheckType check = CHECK_ALL_MAPS) {
return CheckPrototypes(type, object_reg, holder, holder_reg, scratch1,
scratch2, name, kInvalidProtoDepth, miss, check);
}
Register 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 = CHECK_ALL_MAPS); PrototypeCheckType check = CHECK_ALL_MAPS);
void GenerateBooleanCheck(Register object, Label* miss); void GenerateBooleanCheck(Register object, Label* miss);
...@@ -1014,19 +1028,10 @@ class CallOptimization BASE_EMBEDDED { ...@@ -1014,19 +1028,10 @@ class CallOptimization BASE_EMBEDDED {
return api_call_info_; return api_call_info_;
} }
enum HolderLookup { // Returns the depth of the object having the expected type in the
kHolderNotFound, // prototype chain between the two arguments.
kHolderIsReceiver, int GetPrototypeDepthOfExpectedType(Handle<JSObject> object,
kHolderIsPrototypeOfMap Handle<JSObject> holder) const;
};
// Returns a map whose prototype has the expected type in the
// prototype chain between the two arguments
// null will be returned if the first argument has that property
// lookup will be set accordingly
Handle<Map> LookupHolderOfExpectedType(Handle<JSObject> receiver,
Handle<JSObject> object,
Handle<JSObject> holder,
HolderLookup* holder_lookup) const;
bool IsCompatibleReceiver(Object* receiver) { bool IsCompatibleReceiver(Object* receiver) {
ASSERT(is_simple_api_call()); ASSERT(is_simple_api_call());
......
This diff is collapsed.
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