OLD | NEW |
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 7063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7074 v8::HandleScope scope; | 7074 v8::HandleScope scope; |
7075 LocalContext context; | 7075 LocalContext context; |
7076 v8::Handle<v8::Object> obj = v8::Object::New(); | 7076 v8::Handle<v8::Object> obj = v8::Object::New(); |
7077 v8::Handle<v8::FunctionTemplate> func_templ = v8::FunctionTemplate::New(); | 7077 v8::Handle<v8::FunctionTemplate> func_templ = v8::FunctionTemplate::New(); |
7078 v8::Handle<v8::String> foo_string = v8::String::New("foo"); | 7078 v8::Handle<v8::String> foo_string = v8::String::New("foo"); |
7079 obj->Set(foo_string, func_templ->GetFunction()); | 7079 obj->Set(foo_string, func_templ->GetFunction()); |
7080 v8::Handle<v8::Object> obj_clone = obj->Clone(); | 7080 v8::Handle<v8::Object> obj_clone = obj->Clone(); |
7081 obj_clone->Set(foo_string, v8::String::New("Hello")); | 7081 obj_clone->Set(foo_string, v8::String::New("Hello")); |
7082 CHECK(!obj->Get(foo_string)->IsUndefined()); | 7082 CHECK(!obj->Get(foo_string)->IsUndefined()); |
7083 } | 7083 } |
| 7084 |
| 7085 |
| 7086 // Regression test for http://crbug.com/16276. |
| 7087 THREADED_TEST(Regress16276) { |
| 7088 v8::HandleScope scope; |
| 7089 LocalContext context; |
| 7090 // Force the IC in f to be a dictionary load IC. |
| 7091 CompileRun("function f(obj) { return obj.x; }\n" |
| 7092 "var obj = { x: { foo: 42 }, y: 87 };\n" |
| 7093 "var x = obj.x;\n" |
| 7094 "delete obj.y;\n" |
| 7095 "for (var i = 0; i < 5; i++) f(obj);"); |
| 7096 // Detach the global object to make 'this' refer directly to the |
| 7097 // global object (not the proxy), and make sure that the dictionary |
| 7098 // load IC doesn't mess up loading directly from the global object. |
| 7099 context->DetachGlobal(); |
| 7100 CHECK_EQ(42, CompileRun("f(this).foo")->Int32Value()); |
| 7101 } |
OLD | NEW |