OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 { obj, "delete", "1.1", Number::New(6) } | 372 { obj, "delete", "1.1", Number::New(6) } |
373 }; | 373 }; |
374 EXPECT_RECORDS(CompileRun("records"), expected_records); | 374 EXPECT_RECORDS(CompileRun("records"), expected_records); |
375 } | 375 } |
376 | 376 |
377 | 377 |
378 TEST(HiddenPrototypeObservation) { | 378 TEST(HiddenPrototypeObservation) { |
379 HarmonyIsolate isolate; | 379 HarmonyIsolate isolate; |
380 HandleScope scope(isolate.GetIsolate()); | 380 HandleScope scope(isolate.GetIsolate()); |
381 LocalContext context(isolate.GetIsolate()); | 381 LocalContext context(isolate.GetIsolate()); |
382 Handle<FunctionTemplate> tmpl = FunctionTemplate::New(); | 382 Handle<FunctionTemplate> tmpl = FunctionTemplate::New(isolate.GetIsolate()); |
383 tmpl->SetHiddenPrototype(true); | 383 tmpl->SetHiddenPrototype(true); |
384 tmpl->InstanceTemplate()->Set( | 384 tmpl->InstanceTemplate()->Set( |
385 String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75)); | 385 String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75)); |
386 Handle<Object> proto = tmpl->GetFunction()->NewInstance(); | 386 Handle<Object> proto = tmpl->GetFunction()->NewInstance(); |
387 Handle<Object> obj = Object::New(); | 387 Handle<Object> obj = Object::New(); |
388 obj->SetPrototype(proto); | 388 obj->SetPrototype(proto); |
389 context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); | 389 context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); |
390 context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"), | 390 context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"), |
391 proto); | 391 proto); |
392 CompileRun( | 392 CompileRun( |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 "var observer = function(r) { records = r };" | 752 "var observer = function(r) { records = r };" |
753 "Object.observe(obj, observer);"); | 753 "Object.observe(obj, observer);"); |
754 Handle<Value> obj = | 754 Handle<Value> obj = |
755 context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj")); | 755 context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj")); |
756 Handle<Object>::Cast(obj) | 756 Handle<Object>::Cast(obj) |
757 ->SetHiddenValue(String::NewFromUtf8(isolate.GetIsolate(), "foo"), | 757 ->SetHiddenValue(String::NewFromUtf8(isolate.GetIsolate(), "foo"), |
758 Null(isolate.GetIsolate())); | 758 Null(isolate.GetIsolate())); |
759 CompileRun(""); // trigger delivery | 759 CompileRun(""); // trigger delivery |
760 CHECK(CompileRun("records")->IsNull()); | 760 CHECK(CompileRun("records")->IsNull()); |
761 } | 761 } |
OLD | NEW |