| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index dac6935e92b688c3e89852157ad034612af8dc12..233eddae0d0779c796f279d9eda77a872d0d7a86 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -16221,139 +16221,6 @@ TEST(ForceSetWithInterceptor) {
|
| }
|
|
|
|
|
| -THREADED_TEST(ForceDelete) {
|
| - v8::Isolate* isolate = CcTest::isolate();
|
| - v8::HandleScope scope(isolate);
|
| - v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
|
| - LocalContext context(NULL, templ);
|
| - v8::Handle<v8::Object> global = context->Global();
|
| -
|
| - // Ordinary properties
|
| - v8::Handle<v8::String> simple_property =
|
| - v8::String::NewFromUtf8(isolate, "p");
|
| - global->ForceSet(simple_property, v8::Int32::New(isolate, 4), v8::DontDelete);
|
| - CHECK_EQ(4, global->Get(simple_property)->Int32Value());
|
| - // This should fail because the property is dont-delete.
|
| - CHECK(!global->Delete(simple_property));
|
| - CHECK_EQ(4, global->Get(simple_property)->Int32Value());
|
| - // This should succeed even though the property is dont-delete.
|
| - CHECK(global->ForceDelete(simple_property));
|
| - CHECK(global->Get(simple_property)->IsUndefined());
|
| -}
|
| -
|
| -
|
| -static int force_delete_interceptor_count = 0;
|
| -static bool pass_on_delete = false;
|
| -
|
| -
|
| -static void ForceDeleteDeleter(
|
| - v8::Local<v8::Name> name,
|
| - const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| - force_delete_interceptor_count++;
|
| - if (pass_on_delete) return;
|
| - info.GetReturnValue().Set(true);
|
| -}
|
| -
|
| -
|
| -THREADED_TEST(ForceDeleteWithInterceptor) {
|
| - force_delete_interceptor_count = 0;
|
| - pass_on_delete = false;
|
| -
|
| - v8::Isolate* isolate = CcTest::isolate();
|
| - v8::HandleScope scope(isolate);
|
| - v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
|
| - templ->SetHandler(
|
| - v8::NamedPropertyHandlerConfiguration(0, 0, 0, ForceDeleteDeleter));
|
| - LocalContext context(NULL, templ);
|
| - v8::Handle<v8::Object> global = context->Global();
|
| -
|
| - v8::Handle<v8::String> some_property =
|
| - v8::String::NewFromUtf8(isolate, "a");
|
| - global->ForceSet(some_property, v8::Integer::New(isolate, 42),
|
| - v8::DontDelete);
|
| -
|
| - // Deleting a property should get intercepted and nothing should
|
| - // happen.
|
| - CHECK_EQ(0, force_delete_interceptor_count);
|
| - CHECK(global->Delete(some_property));
|
| - CHECK_EQ(1, force_delete_interceptor_count);
|
| - CHECK_EQ(42, global->Get(some_property)->Int32Value());
|
| - // Deleting the property when the interceptor returns an empty
|
| - // handle should not delete the property since it is DontDelete.
|
| - pass_on_delete = true;
|
| - CHECK(!global->Delete(some_property));
|
| - CHECK_EQ(2, force_delete_interceptor_count);
|
| - CHECK_EQ(42, global->Get(some_property)->Int32Value());
|
| - // Forcing the property to be deleted should delete the value
|
| - // without calling the interceptor.
|
| - CHECK(global->ForceDelete(some_property));
|
| - CHECK(global->Get(some_property)->IsUndefined());
|
| - CHECK_EQ(2, force_delete_interceptor_count);
|
| -}
|
| -
|
| -
|
| -// Make sure that forcing a delete invalidates any IC stubs, so we
|
| -// don't read the hole value.
|
| -THREADED_TEST(ForceDeleteIC) {
|
| - LocalContext context;
|
| - v8::HandleScope scope(context->GetIsolate());
|
| - // Create a DontDelete variable on the global object.
|
| - CompileRun("this.__proto__ = { foo: 'horse' };"
|
| - "var foo = 'fish';"
|
| - "function f() { return foo.length; }");
|
| - // Initialize the IC for foo in f.
|
| - CompileRun("for (var i = 0; i < 4; i++) f();");
|
| - // Make sure the value of foo is correct before the deletion.
|
| - CHECK_EQ(4, CompileRun("f()")->Int32Value());
|
| - // Force the deletion of foo.
|
| - CHECK(context->Global()->ForceDelete(v8_str("foo")));
|
| - // Make sure the value for foo is read from the prototype, and that
|
| - // we don't get in trouble with reading the deleted cell value
|
| - // sentinel.
|
| - CHECK_EQ(5, CompileRun("f()")->Int32Value());
|
| -}
|
| -
|
| -
|
| -TEST(InlinedFunctionAcrossContexts) {
|
| - i::FLAG_allow_natives_syntax = true;
|
| - v8::Isolate* isolate = CcTest::isolate();
|
| - v8::HandleScope outer_scope(isolate);
|
| - v8::Local<v8::Context> ctx1 = v8::Context::New(isolate);
|
| - v8::Local<v8::Context> ctx2 = v8::Context::New(isolate);
|
| - ctx1->Enter();
|
| -
|
| - {
|
| - v8::HandleScope inner_scope(CcTest::isolate());
|
| - CompileRun("var G = 42; function foo() { return G; }");
|
| - v8::Local<v8::Value> foo = ctx1->Global()->Get(v8_str("foo"));
|
| - ctx2->Enter();
|
| - ctx2->Global()->Set(v8_str("o"), foo);
|
| - v8::Local<v8::Value> res = CompileRun(
|
| - "function f() { return o(); }"
|
| - "for (var i = 0; i < 10; ++i) f();"
|
| - "%OptimizeFunctionOnNextCall(f);"
|
| - "f();");
|
| - CHECK_EQ(42, res->Int32Value());
|
| - ctx2->Exit();
|
| - v8::Handle<v8::String> G_property =
|
| - v8::String::NewFromUtf8(CcTest::isolate(), "G");
|
| - CHECK(ctx1->Global()->ForceDelete(G_property));
|
| - ctx2->Enter();
|
| - ExpectString(
|
| - "(function() {"
|
| - " try {"
|
| - " return f();"
|
| - " } catch(e) {"
|
| - " return e.toString();"
|
| - " }"
|
| - " })()",
|
| - "ReferenceError: G is not defined");
|
| - ctx2->Exit();
|
| - ctx1->Exit();
|
| - }
|
| -}
|
| -
|
| -
|
| static v8::Local<Context> calling_context0;
|
| static v8::Local<Context> calling_context1;
|
| static v8::Local<Context> calling_context2;
|
| @@ -20821,62 +20688,6 @@ TEST(DontDeleteCellLoadIC) {
|
| }
|
|
|
|
|
| -TEST(DontDeleteCellLoadICForceDelete) {
|
| - const char* function_code =
|
| - "function readCell() { while (true) { return cell; } }";
|
| -
|
| - // Run the code twice to initialize the load IC for a don't delete
|
| - // cell.
|
| - LocalContext context;
|
| - v8::HandleScope scope(context->GetIsolate());
|
| - CompileRun("var cell = \"value\";");
|
| - ExpectBoolean("delete cell", false);
|
| - CompileRun(function_code);
|
| - ExpectString("readCell()", "value");
|
| - ExpectString("readCell()", "value");
|
| -
|
| - // Delete the cell using the API and check the inlined code works
|
| - // correctly.
|
| - CHECK(context->Global()->ForceDelete(v8_str("cell")));
|
| - ExpectString("(function() {"
|
| - " try {"
|
| - " return readCell();"
|
| - " } catch(e) {"
|
| - " return e.toString();"
|
| - " }"
|
| - "})()",
|
| - "ReferenceError: cell is not defined");
|
| -}
|
| -
|
| -
|
| -TEST(DontDeleteCellLoadICAPI) {
|
| - const char* function_code =
|
| - "function readCell() { while (true) { return cell; } }";
|
| -
|
| - // Run the code twice to initialize the load IC for a don't delete
|
| - // cell created using the API.
|
| - LocalContext context;
|
| - v8::HandleScope scope(context->GetIsolate());
|
| - context->Global()->ForceSet(v8_str("cell"), v8_str("value"), v8::DontDelete);
|
| - ExpectBoolean("delete cell", false);
|
| - CompileRun(function_code);
|
| - ExpectString("readCell()", "value");
|
| - ExpectString("readCell()", "value");
|
| -
|
| - // Delete the cell using the API and check the inlined code works
|
| - // correctly.
|
| - CHECK(context->Global()->ForceDelete(v8_str("cell")));
|
| - ExpectString("(function() {"
|
| - " try {"
|
| - " return readCell();"
|
| - " } catch(e) {"
|
| - " return e.toString();"
|
| - " }"
|
| - "})()",
|
| - "ReferenceError: cell is not defined");
|
| -}
|
| -
|
| -
|
| class Visitor42 : public v8::PersistentHandleVisitor {
|
| public:
|
| explicit Visitor42(v8::Persistent<v8::Object>* object)
|
|
|