Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: test/cctest/test-api.cc

Issue 149322: Fix crash that occurs when we're forced to delete a global... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6944 matching lines...) Expand 10 before | Expand all | Expand 10 after
6955 CHECK_EQ(2, force_delete_interceptor_count); 6955 CHECK_EQ(2, force_delete_interceptor_count);
6956 CHECK_EQ(42, global->Get(some_property)->Int32Value()); 6956 CHECK_EQ(42, global->Get(some_property)->Int32Value());
6957 // Forcing the property to be deleted should delete the value 6957 // Forcing the property to be deleted should delete the value
6958 // without calling the interceptor. 6958 // without calling the interceptor.
6959 CHECK(global->ForceDelete(some_property)); 6959 CHECK(global->ForceDelete(some_property));
6960 CHECK(global->Get(some_property)->IsUndefined()); 6960 CHECK(global->Get(some_property)->IsUndefined());
6961 CHECK_EQ(2, force_delete_interceptor_count); 6961 CHECK_EQ(2, force_delete_interceptor_count);
6962 } 6962 }
6963 6963
6964 6964
6965 // Make sure that forcing a delete invalidates any IC stubs, so we
6966 // don't read the hole value.
6967 THREADED_TEST(ForceDeleteIC) {
6968 v8::HandleScope scope;
6969 LocalContext context;
6970 // Create a DontDelete variable on the global object.
6971 CompileRun("this.__proto__ = { foo: 'horse' };"
6972 "var foo = 'fish';"
6973 "function f() { return foo.length; }");
6974 // Initialize the IC for foo in f.
6975 CompileRun("for (var i = 0; i < 4; i++) f();");
6976 // Make sure the value of foo is correct before the deletion.
6977 CHECK_EQ(4, CompileRun("f()")->Int32Value());
6978 // Force the deletion of foo.
6979 CHECK(context->Global()->ForceDelete(v8_str("foo")));
6980 // Make sure the value for foo is read from the prototype, and that
6981 // we don't get in trouble with reading the deleted cell value
6982 // sentinel.
6983 CHECK_EQ(5, CompileRun("f()")->Int32Value());
6984 }
6985
6986
6965 v8::Persistent<Context> calling_context0; 6987 v8::Persistent<Context> calling_context0;
6966 v8::Persistent<Context> calling_context1; 6988 v8::Persistent<Context> calling_context1;
6967 v8::Persistent<Context> calling_context2; 6989 v8::Persistent<Context> calling_context2;
6968 6990
6969 6991
6970 // Check that the call to the callback is initiated in 6992 // Check that the call to the callback is initiated in
6971 // calling_context2, the directly calling context is calling_context1 6993 // calling_context2, the directly calling context is calling_context1
6972 // and the callback itself is in calling_context0. 6994 // and the callback itself is in calling_context0.
6973 static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) { 6995 static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) {
6974 ApiTestFuzzer::Fuzz(); 6996 ApiTestFuzzer::Fuzz();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
7052 v8::HandleScope scope; 7074 v8::HandleScope scope;
7053 LocalContext context; 7075 LocalContext context;
7054 v8::Handle<v8::Object> obj = v8::Object::New(); 7076 v8::Handle<v8::Object> obj = v8::Object::New();
7055 v8::Handle<v8::FunctionTemplate> func_templ = v8::FunctionTemplate::New(); 7077 v8::Handle<v8::FunctionTemplate> func_templ = v8::FunctionTemplate::New();
7056 v8::Handle<v8::String> foo_string = v8::String::New("foo"); 7078 v8::Handle<v8::String> foo_string = v8::String::New("foo");
7057 obj->Set(foo_string, func_templ->GetFunction()); 7079 obj->Set(foo_string, func_templ->GetFunction());
7058 v8::Handle<v8::Object> obj_clone = obj->Clone(); 7080 v8::Handle<v8::Object> obj_clone = obj->Clone();
7059 obj_clone->Set(foo_string, v8::String::New("Hello")); 7081 obj_clone->Set(foo_string, v8::String::New("Hello"));
7060 CHECK(!obj->Get(foo_string)->IsUndefined()); 7082 CHECK(!obj->Get(foo_string)->IsUndefined());
7061 } 7083 }
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698