Revision: 22659
Author: [email protected]
Date: Tue Jul 29 08:09:14 2014 UTC
Log: Restore DefineApiAccessorProperty
BUG=
[email protected]
Review URL: https://codereview.chromium.org/428463005
http://code.google.com/p/v8/source/detail?r=22659
Modified:
/branches/bleeding_edge/src/apinatives.js
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/runtime.h
/branches/bleeding_edge/test/mjsunit/runtime-gen/estimatenumberofelements.js
/branches/bleeding_edge/tools/generate-runtime-tests.py
=======================================
--- /branches/bleeding_edge/src/apinatives.js Tue Jul 1 10:00:19 2014 UTC
+++ /branches/bleeding_edge/src/apinatives.js Tue Jul 29 08:09:14 2014 UTC
@@ -104,10 +104,10 @@
// TODO(verwaest): The 5th value used to be access_control. Remove
once
// the bindings are updated.
var name = properties[i + 1];
- var getter = Instantiate(properties[i + 2]);
- var setter = Instantiate(properties[i + 3]);
+ var getter = properties[i + 2];
+ var setter = properties[i + 3];
var attribute = properties[i + 4];
- %DefineAccessorPropertyUnchecked(obj, name, getter, setter,
attribute);
+ %DefineApiAccessorProperty(obj, name, getter, setter, attribute);
} else {
throw "Bad properties array";
}
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Jul 28 13:12:26 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Tue Jul 29 08:09:14 2014 UTC
@@ -4925,6 +4925,37 @@
static bool IsValidAccessor(Handle<Object> obj) {
return obj->IsUndefined() || obj->IsSpecFunction() || obj->IsNull();
}
+
+
+// Transform getter or setter into something DefineAccessor can handle.
+static Handle<Object> InstantiateAccessorComponent(Isolate* isolate,
+ Handle<Object>
component) {
+ if (component->IsUndefined()) return isolate->factory()->null_value();
+ Handle<FunctionTemplateInfo> info =
+ Handle<FunctionTemplateInfo>::cast(component);
+ return Utils::OpenHandle(*Utils::ToLocal(info)->GetFunction());
+}
+
+
+RUNTIME_FUNCTION(Runtime_DefineApiAccessorProperty) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 5);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2);
+ CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3);
+ CONVERT_SMI_ARG_CHECKED(attribute, 4);
+ RUNTIME_ASSERT(getter->IsUndefined() ||
getter->IsFunctionTemplateInfo());
+ RUNTIME_ASSERT(setter->IsUndefined() ||
setter->IsFunctionTemplateInfo());
+ RUNTIME_ASSERT(PropertyDetails::AttributesField::is_valid(
+ static_cast<PropertyAttributes>(attribute)));
+ RETURN_FAILURE_ON_EXCEPTION(
+ isolate, JSObject::DefineAccessor(
+ object, name, InstantiateAccessorComponent(isolate,
getter),
+ InstantiateAccessorComponent(isolate, setter),
+ static_cast<PropertyAttributes>(attribute)));
+ return isolate->heap()->undefined_value();
+}
// Implements part of 8.12.9 DefineOwnProperty.
=======================================
--- /branches/bleeding_edge/src/runtime.h Mon Jul 28 13:12:26 2014 UTC
+++ /branches/bleeding_edge/src/runtime.h Tue Jul 29 08:09:14 2014 UTC
@@ -228,6 +228,7 @@
F(AddNamedProperty, 4, 1) \
F(AddPropertyForTemplate, 4, 1) \
F(SetProperty, 4, 1) \
+ F(DefineApiAccessorProperty, 5, 1) \
F(DefineDataPropertyUnchecked, 4, 1) \
F(DefineAccessorPropertyUnchecked, 5, 1) \
F(GetDataProperty, 2, 1) \
=======================================
---
/branches/bleeding_edge/test/mjsunit/runtime-gen/estimatenumberofelements.js
Thu May 8 13:11:59 2014 UTC
+++
/branches/bleeding_edge/test/mjsunit/runtime-gen/estimatenumberofelements.js
Tue Jul 29 08:09:14 2014 UTC
@@ -1,5 +1,5 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY
// Flags: --allow-natives-syntax --harmony
-var _object = new Array();
-%EstimateNumberOfElements(_object);
+var _array = new Array();
+%EstimateNumberOfElements(_array);
=======================================
--- /branches/bleeding_edge/tools/generate-runtime-tests.py Mon Jul 28
13:12:26 2014 UTC
+++ /branches/bleeding_edge/tools/generate-runtime-tests.py Tue Jul 29
08:09:14 2014 UTC
@@ -47,8 +47,8 @@
# that the parser doesn't bit-rot. Change the values as needed when you
add,
# remove or change runtime functions, but make sure we don't lose our
ability
# to parse them!
-EXPECTED_FUNCTION_COUNT = 421
-EXPECTED_FUZZABLE_COUNT = 335
+EXPECTED_FUNCTION_COUNT = 422
+EXPECTED_FUZZABLE_COUNT = 336
EXPECTED_CCTEST_COUNT = 8
EXPECTED_UNKNOWN_COUNT = 4
EXPECTED_BUILTINS_COUNT = 815
@@ -245,7 +245,7 @@
"NumberToRadixString": [None, "2", None],
"ParseJson": ["\"{}\"", 1],
"RegExpExecMultiple": [None, None, "['a']", "['a']", None],
- "DefineAccessorProperty": [None, None, "undefined", "undefined", None,
None],
+ "DefineApiAccessorProperty": [None, None, "undefined", "undefined",
None, None],
"SetIteratorInitialize": [None, None, "2", None],
"SetDebugEventListener": ["undefined", None, None],
"SetFunctionBreakPoint": [None, 200, None, None],
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.