Removed Runtime_DefineAccessor.

Runtime_DefineOrRedfineAccessorProperty basically does the same, so we have 1
code path less to worry about.

Review URL: https://chromiumcodereview.appspot.com/9424033

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10779 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f5c8ac98
......@@ -1523,7 +1523,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
Smi::FromInt(0)));
__ push(r1);
VisitForStackValue(value);
__ CallRuntime(Runtime::kDefineAccessor, 4);
__ mov(r0, Operand(Smi::FromInt(NONE)));
__ push(r0);
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
break;
}
}
......
......@@ -1497,7 +1497,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
Smi::FromInt(1) :
Smi::FromInt(0)));
VisitForStackValue(value);
__ CallRuntime(Runtime::kDefineAccessor, 4);
__ push(Immediate(Smi::FromInt(NONE)));
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
break;
default: UNREACHABLE();
}
......
......@@ -1532,7 +1532,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
Smi::FromInt(0)));
__ push(a1);
VisitForStackValue(value);
__ CallRuntime(Runtime::kDefineAccessor, 4);
__ li(a0, Operand(Smi::FromInt(NONE)));
__ push(a0);
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
break;
}
}
......
......@@ -421,16 +421,18 @@ function SetUpRegExp() {
LAST_INPUT(lastMatchInfo) = ToString(string);
};
%DefineAccessor($RegExp, 'input', GETTER, RegExpGetInput, DONT_DELETE);
%DefineAccessor($RegExp, 'input', SETTER, RegExpSetInput, DONT_DELETE);
%DefineAccessor($RegExp, '$_', GETTER, RegExpGetInput,
DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$_', SETTER, RegExpSetInput,
DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$input', GETTER, RegExpGetInput,
DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$input', SETTER, RegExpSetInput,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'input', GETTER, RegExpGetInput,
DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'input', SETTER, RegExpSetInput,
DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$_', GETTER, RegExpGetInput,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$_', SETTER, RegExpSetInput,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$input', GETTER, RegExpGetInput,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$input', SETTER, RegExpSetInput,
DONT_ENUM | DONT_DELETE);
// The properties multiline and $* are aliases for each other. When this
// value is set in SpiderMonkey, the value it is set to is coerced to a
......@@ -444,49 +446,59 @@ function SetUpRegExp() {
var RegExpGetMultiline = function() { return multiline; };
var RegExpSetMultiline = function(flag) { multiline = flag ? true : false; };
%DefineAccessor($RegExp, 'multiline', GETTER, RegExpGetMultiline,
DONT_DELETE);
%DefineAccessor($RegExp, 'multiline', SETTER, RegExpSetMultiline,
DONT_DELETE);
%DefineAccessor($RegExp, '$*', GETTER, RegExpGetMultiline,
DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$*', SETTER, RegExpSetMultiline,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'multiline', GETTER,
RegExpGetMultiline, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'multiline', SETTER,
RegExpSetMultiline, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$*', GETTER, RegExpGetMultiline,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$*', SETTER, RegExpSetMultiline,
DONT_ENUM | DONT_DELETE);
var NoOpSetter = function(ignored) {};
// Static properties set by a successful match.
%DefineAccessor($RegExp, 'lastMatch', GETTER, RegExpGetLastMatch,
DONT_DELETE);
%DefineAccessor($RegExp, 'lastMatch', SETTER, NoOpSetter, DONT_DELETE);
%DefineAccessor($RegExp, '$&', GETTER, RegExpGetLastMatch,
DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$&', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, 'lastParen', GETTER, RegExpGetLastParen,
DONT_DELETE);
%DefineAccessor($RegExp, 'lastParen', SETTER, NoOpSetter, DONT_DELETE);
%DefineAccessor($RegExp, '$+', GETTER, RegExpGetLastParen,
DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$+', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, 'leftContext', GETTER, RegExpGetLeftContext,
DONT_DELETE);
%DefineAccessor($RegExp, 'leftContext', SETTER, NoOpSetter, DONT_DELETE);
%DefineAccessor($RegExp, '$`', GETTER, RegExpGetLeftContext,
DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, '$`', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, 'rightContext', GETTER, RegExpGetRightContext,
DONT_DELETE);
%DefineAccessor($RegExp, 'rightContext', SETTER, NoOpSetter, DONT_DELETE);
%DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext,
DONT_ENUM | DONT_DELETE);
%DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'lastMatch', GETTER,
RegExpGetLastMatch, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'lastMatch', SETTER, NoOpSetter,
DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$&', GETTER, RegExpGetLastMatch,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$&', SETTER, NoOpSetter,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'lastParen', GETTER,
RegExpGetLastParen, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'lastParen', SETTER, NoOpSetter,
DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$+', GETTER, RegExpGetLastParen,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$+', SETTER, NoOpSetter,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'leftContext', GETTER,
RegExpGetLeftContext, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'leftContext', SETTER, NoOpSetter,
DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$`', GETTER, RegExpGetLeftContext,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$`', SETTER, NoOpSetter,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'rightContext', GETTER,
RegExpGetRightContext, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, 'rightContext', SETTER, NoOpSetter,
DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, "$'", GETTER,
RegExpGetRightContext,
DONT_ENUM | DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, "$'", SETTER, NoOpSetter,
DONT_ENUM | DONT_DELETE);
for (var i = 1; i < 10; ++i) {
%DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i),
DONT_DELETE);
%DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$' + i, GETTER,
RegExpMakeCaptureGetter(i), DONT_DELETE);
%DefineOrRedefineAccessorProperty($RegExp, '$' + i, SETTER, NoOpSetter,
DONT_DELETE);
}
}
......
......@@ -10359,30 +10359,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArrayKeys) {
}
// DefineAccessor takes an optional final argument which is the
// property attributes (e.g. DONT_ENUM, DONT_DELETE). IMPORTANT: due
// to the way accessors are implemented, it is set for both the getter
// and setter on the first call to DefineAccessor and ignored on
// subsequent calls.
RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineAccessor) {
RUNTIME_ASSERT(args.length() == 4 || args.length() == 5);
// Compute attributes.
PropertyAttributes attributes = NONE;
if (args.length() == 5) {
CONVERT_SMI_ARG_CHECKED(value, 4);
// Only attribute bits should be set.
ASSERT((value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
attributes = static_cast<PropertyAttributes>(value);
}
CONVERT_ARG_CHECKED(JSObject, obj, 0);
CONVERT_ARG_CHECKED(String, name, 1);
CONVERT_SMI_ARG_CHECKED(flag, 2);
CONVERT_ARG_CHECKED(JSFunction, fun, 3);
return obj->DefineAccessor(name, flag == 0, fun, attributes);
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) {
ASSERT(args.length() == 3);
CONVERT_ARG_CHECKED(JSObject, obj, 0);
......
......@@ -274,7 +274,6 @@ namespace internal {
F(SwapElements, 3, 1) \
\
/* Getters and Setters */ \
F(DefineAccessor, -1 /* 4 or 5 */, 1) \
F(LookupAccessor, 3, 1) \
\
/* Literals */ \
......
......@@ -1482,7 +1482,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
Smi::FromInt(1) :
Smi::FromInt(0));
VisitForStackValue(value);
__ CallRuntime(Runtime::kDefineAccessor, 4);
__ Push(Smi::FromInt(NONE));
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
break;
}
}
......
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