| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 { obj, "delete", "1.1", Number::New(6) } | 380 { obj, "delete", "1.1", Number::New(6) } |
| 381 }; | 381 }; |
| 382 EXPECT_RECORDS(CompileRun("records"), expected_records); | 382 EXPECT_RECORDS(CompileRun("records"), expected_records); |
| 383 } | 383 } |
| 384 | 384 |
| 385 | 385 |
| 386 TEST(HiddenPrototypeObservation) { | 386 TEST(HiddenPrototypeObservation) { |
| 387 HarmonyIsolate isolate; | 387 HarmonyIsolate isolate; |
| 388 HandleScope scope(isolate.GetIsolate()); | 388 HandleScope scope(isolate.GetIsolate()); |
| 389 LocalContext context(isolate.GetIsolate()); | 389 LocalContext context(isolate.GetIsolate()); |
| 390 Handle<FunctionTemplate> tmpl = FunctionTemplate::New(); | 390 Handle<FunctionTemplate> tmpl = FunctionTemplate::New(isolate.GetIsolate()); |
| 391 tmpl->SetHiddenPrototype(true); | 391 tmpl->SetHiddenPrototype(true); |
| 392 tmpl->InstanceTemplate()->Set( | 392 tmpl->InstanceTemplate()->Set( |
| 393 String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75)); | 393 String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75)); |
| 394 Handle<Object> proto = tmpl->GetFunction()->NewInstance(); | 394 Handle<Object> proto = tmpl->GetFunction()->NewInstance(); |
| 395 Handle<Object> obj = Object::New(); | 395 Handle<Object> obj = Object::New(); |
| 396 obj->SetPrototype(proto); | 396 obj->SetPrototype(proto); |
| 397 context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); | 397 context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); |
| 398 context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"), | 398 context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"), |
| 399 proto); | 399 proto); |
| 400 CompileRun( | 400 CompileRun( |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 "var observer = function(r) { records = r };" | 760 "var observer = function(r) { records = r };" |
| 761 "Object.observe(obj, observer);"); | 761 "Object.observe(obj, observer);"); |
| 762 Handle<Value> obj = | 762 Handle<Value> obj = |
| 763 context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj")); | 763 context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj")); |
| 764 Handle<Object>::Cast(obj) | 764 Handle<Object>::Cast(obj) |
| 765 ->SetHiddenValue(String::NewFromUtf8(isolate.GetIsolate(), "foo"), | 765 ->SetHiddenValue(String::NewFromUtf8(isolate.GetIsolate(), "foo"), |
| 766 Null(isolate.GetIsolate())); | 766 Null(isolate.GetIsolate())); |
| 767 CompileRun(""); // trigger delivery | 767 CompileRun(""); // trigger delivery |
| 768 CHECK(CompileRun("records")->IsNull()); | 768 CHECK(CompileRun("records")->IsNull()); |
| 769 } | 769 } |
| OLD | NEW |