Revert "Handlify JSObject::AddProperty method" for performance.

TBR=verwaest@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16655 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6790b837
This diff is collapsed.
...@@ -2145,12 +2145,17 @@ class JSObject: public JSReceiver { ...@@ -2145,12 +2145,17 @@ class JSObject: public JSReceiver {
Object* value, Object* value,
JSObject* holder, JSObject* holder,
StrictModeFlag strict_mode); StrictModeFlag strict_mode);
static Handle<Object> SetPropertyWithInterceptor( MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor(
Handle<JSObject> object, Name* name,
Handle<Name> name, Object* value,
Handle<Object> value,
PropertyAttributes attributes, PropertyAttributes attributes,
StrictModeFlag strict_mode); StrictModeFlag strict_mode);
MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor(
Name* name,
Object* value,
PropertyAttributes attributes,
StrictModeFlag strict_mode,
StoreMode mode = ALLOW_AS_CONSTANT);
static Handle<Object> SetLocalPropertyIgnoreAttributes( static Handle<Object> SetLocalPropertyIgnoreAttributes(
Handle<JSObject> object, Handle<JSObject> object,
...@@ -2471,7 +2476,6 @@ class JSObject: public JSReceiver { ...@@ -2471,7 +2476,6 @@ class JSObject: public JSReceiver {
// Add a property to a fast-case object using a map transition to // Add a property to a fast-case object using a map transition to
// new_map. // new_map.
// TODO(mstarzinger): Only public because of SetPropertyUsingTransition!
MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap( MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap(
Map* new_map, Map* new_map,
Name* name, Name* name,
...@@ -2479,6 +2483,18 @@ class JSObject: public JSReceiver { ...@@ -2479,6 +2483,18 @@ class JSObject: public JSReceiver {
int field_index, int field_index,
Representation representation); Representation representation);
// Add a constant function property to a fast-case object.
// This leaves a CONSTANT_TRANSITION in the old map, and
// if it is called on a second object with this map, a
// normal property is added instead, with a map transition.
// This avoids the creation of many maps with the same constant
// function, all orphaned.
MUST_USE_RESULT MaybeObject* AddConstantProperty(
Name* name,
Object* constant,
PropertyAttributes attributes,
TransitionFlag flag);
MUST_USE_RESULT MaybeObject* ReplaceSlowProperty( MUST_USE_RESULT MaybeObject* ReplaceSlowProperty(
Name* name, Name* name,
Object* value, Object* value,
...@@ -2506,12 +2522,24 @@ class JSObject: public JSReceiver { ...@@ -2506,12 +2522,24 @@ class JSObject: public JSReceiver {
Representation new_representation, Representation new_representation,
StoreMode store_mode); StoreMode store_mode);
// Add a property to an object. // Add a property to a fast-case object.
// TODO(mstarzinger): Only public because of SetPropertyUsingTransition! MUST_USE_RESULT MaybeObject* AddFastProperty(
static Handle<Object> AddProperty( Name* name,
Handle<JSObject> object, Object* value,
Handle<Name> name, PropertyAttributes attributes,
Handle<Object> value, StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
ValueType value_type = OPTIMAL_REPRESENTATION,
TransitionFlag flag = INSERT_TRANSITION);
// Add a property to a slow-case object.
MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name,
Object* value,
PropertyAttributes attributes);
// Add a property to an object. May cause GC.
MUST_USE_RESULT MaybeObject* AddProperty(
Name* name,
Object* value,
PropertyAttributes attributes, PropertyAttributes attributes,
StrictModeFlag strict_mode, StrictModeFlag strict_mode,
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
...@@ -2746,62 +2774,13 @@ class JSObject: public JSReceiver { ...@@ -2746,62 +2774,13 @@ class JSObject: public JSReceiver {
// Searches the prototype chain for property 'name'. If it is found and // Searches the prototype chain for property 'name'. If it is found and
// has a setter, invoke it and set '*done' to true. If it is found and is // has a setter, invoke it and set '*done' to true. If it is found and is
// read-only, reject and set '*done' to true. Otherwise, set '*done' to // read-only, reject and set '*done' to true. Otherwise, set '*done' to
// false. Can throw and return an empty handle with '*done==true'. // false. Can cause GC and can return a failure result with '*done==true'.
static Handle<Object> SetPropertyViaPrototypes( MUST_USE_RESULT MaybeObject* SetPropertyViaPrototypes(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictModeFlag strict_mode,
bool* done);
static Handle<Object> SetPropertyPostInterceptor(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictModeFlag strict_mode);
// Add a constant function property to a fast-case object.
// This leaves a CONSTANT_TRANSITION in the old map, and
// if it is called on a second object with this map, a
// normal property is added instead, with a map transition.
// This avoids the creation of many maps with the same constant
// function, all orphaned.
static void AddConstantProperty(Handle<JSObject> object,
Handle<Name> name,
Handle<Object> constant,
PropertyAttributes attributes,
TransitionFlag flag);
MUST_USE_RESULT MaybeObject* AddConstantProperty(
Name* name,
Object* constant,
PropertyAttributes attributes,
TransitionFlag flag);
// Add a property to a fast-case object.
static void AddFastProperty(Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StoreFromKeyed store_mode,
ValueType value_type,
TransitionFlag flag);
MUST_USE_RESULT MaybeObject* AddFastProperty(
Name* name, Name* name,
Object* value, Object* value,
PropertyAttributes attributes, PropertyAttributes attributes,
StoreFromKeyed store_mode, StrictModeFlag strict_mode,
ValueType value_type, bool* done);
TransitionFlag flag);
// Add a property to a slow-case object.
static void AddSlowProperty(Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes);
MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name,
Object* value,
PropertyAttributes attributes);
static Handle<Object> DeleteProperty(Handle<JSObject> object, static Handle<Object> DeleteProperty(Handle<JSObject> object,
Handle<Name> name, Handle<Name> name,
......
...@@ -1404,19 +1404,17 @@ RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) { ...@@ -1404,19 +1404,17 @@ RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) {
RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) { RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) {
HandleScope scope(isolate);
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
Handle<JSObject> recv(JSObject::cast(args[0])); JSObject* recv = JSObject::cast(args[0]);
Handle<Name> name(Name::cast(args[1])); Name* name = Name::cast(args[1]);
Handle<Object> value(args[2], isolate); Object* value = args[2];
ASSERT(args.smi_at(3) == kStrictMode || args.smi_at(3) == kNonStrictMode); ASSERT(args.smi_at(3) == kStrictMode || args.smi_at(3) == kNonStrictMode);
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(3)); StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(3));
ASSERT(recv->HasNamedInterceptor()); ASSERT(recv->HasNamedInterceptor());
PropertyAttributes attr = NONE; PropertyAttributes attr = NONE;
Handle<Object> result = JSObject::SetPropertyWithInterceptor( MaybeObject* result = recv->SetPropertyWithInterceptor(
recv, name, value, attr, strict_mode); name, value, attr, strict_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result); return result;
return *result;
} }
......
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