Update to V8 with partial snapshots. This is taken from the partial_snapshot branch of V8.
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index f71b325..0a392eb 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -38,7 +38,7 @@
#include "utils.h"
#include "cctest.h"
-static const bool kLogThreading = false;
+static const bool kLogThreading = true;
static bool IsNaN(double x) {
#ifdef WIN32
@@ -2297,6 +2297,103 @@
}
}
+THREADED_TEST(DefinePropertyOnAPIAccessor) {
+ v8::HandleScope scope;
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut"));
+ LocalContext context;
+ context->Global()->Set(v8_str("obj"), templ->NewInstance());
+
+ // Uses getOwnPropertyDescriptor to check the configurable status
+ Local<Script> script_desc
+ = Script::Compile(v8_str("var prop =Object.getOwnPropertyDescriptor( "
+ "obj, 'x');"
+ "prop.configurable;"));
+ Local<Value> result = script_desc->Run();
+ CHECK_EQ(result->BooleanValue(), true);
+
+ // Redefine get - but still configurable
+ Local<Script> script_define
+ = Script::Compile(v8_str("var desc = { get: function(){return 42; },"
+ " configurable: true };"
+ "Object.defineProperty(obj, 'x', desc);"
+ "obj.x"));
+ result = script_define->Run();
+ CHECK_EQ(result, v8_num(42));
+
+ // Check that the accessor is still configurable
+ result = script_desc->Run();
+ CHECK_EQ(result->BooleanValue(), true);
+
+ // Redefine to a non-configurable
+ script_define
+ = Script::Compile(v8_str("var desc = { get: function(){return 43; },"
+ " configurable: false };"
+ "Object.defineProperty(obj, 'x', desc);"
+ "obj.x"));
+ result = script_define->Run();
+ CHECK_EQ(result, v8_num(43));
+ result = script_desc->Run();
+ CHECK_EQ(result->BooleanValue(), false);
+
+ // Make sure that it is not possible to redefine again
+ v8::TryCatch try_catch;
+ result = script_define->Run();
+ CHECK(try_catch.HasCaught());
+ String::AsciiValue exception_value(try_catch.Exception());
+ CHECK_EQ(*exception_value,
+ "TypeError: Cannot redefine property: defineProperty");
+}
+
+THREADED_TEST(DefinePropertyOnDefineGetterSetter) {
+ v8::HandleScope scope;
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut"));
+ LocalContext context;
+ context->Global()->Set(v8_str("obj"), templ->NewInstance());
+
+ Local<Script> script_desc = Script::Compile(v8_str("var prop ="
+ "Object.getOwnPropertyDescriptor( "
+ "obj, 'x');"
+ "prop.configurable;"));
+ Local<Value> result = script_desc->Run();
+ CHECK_EQ(result->BooleanValue(), true);
+
+ Local<Script> script_define =
+ Script::Compile(v8_str("var desc = {get: function(){return 42; },"
+ " configurable: true };"
+ "Object.defineProperty(obj, 'x', desc);"
+ "obj.x"));
+ result = script_define->Run();
+ CHECK_EQ(result, v8_num(42));
+
+
+ result = script_desc->Run();
+ CHECK_EQ(result->BooleanValue(), true);
+
+
+ script_define =
+ Script::Compile(v8_str("var desc = {get: function(){return 43; },"
+ " configurable: false };"
+ "Object.defineProperty(obj, 'x', desc);"
+ "obj.x"));
+ result = script_define->Run();
+ CHECK_EQ(result, v8_num(43));
+ result = script_desc->Run();
+
+ CHECK_EQ(result->BooleanValue(), false);
+
+ v8::TryCatch try_catch;
+ result = script_define->Run();
+ CHECK(try_catch.HasCaught());
+ String::AsciiValue exception_value(try_catch.Exception());
+ CHECK_EQ(*exception_value,
+ "TypeError: Cannot redefine property: defineProperty");
+}
+
+
+
+
v8::Persistent<Value> xValue;
@@ -4097,6 +4194,7 @@
value = v8_compile("other.accessible_prop = 3")->Run();
CHECK(value->IsNumber());
CHECK_EQ(3, value->Int32Value());
+ CHECK_EQ(3, g_echo_value);
value = v8_compile("other.accessible_prop")->Run();
CHECK(value->IsNumber());
@@ -4980,7 +5078,7 @@
static v8::Handle<Value> call_as_function(const v8::Arguments& args) {
- ApiTestFuzzer::Fuzz();
+ //ApiTestFuzzer::Fuzz();
if (args.IsConstructCall()) {
if (args[0]->IsInt32()) {
return v8_num(-args[0]->Int32Value());