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 4034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4045 Local<Object>::New(iso, g2s1.handle.As<Object>())->Set( | 4045 Local<Object>::New(iso, g2s1.handle.As<Object>())->Set( |
4046 v8_str("x"), Local<Value>::New(iso, g3s1.handle)); | 4046 v8_str("x"), Local<Value>::New(iso, g3s1.handle)); |
4047 iso->SetObjectGroupId(g3s1.handle, UniqueId(3)); | 4047 iso->SetObjectGroupId(g3s1.handle, UniqueId(3)); |
4048 iso->SetObjectGroupId(g3s2.handle, UniqueId(3)); | 4048 iso->SetObjectGroupId(g3s2.handle, UniqueId(3)); |
4049 Local<Object>::New(iso, g3s1.handle.As<Object>())->Set( | 4049 Local<Object>::New(iso, g3s1.handle.As<Object>())->Set( |
4050 v8_str("x"), Local<Value>::New(iso, g1s1.handle)); | 4050 v8_str("x"), Local<Value>::New(iso, g1s1.handle)); |
4051 } | 4051 } |
4052 | 4052 |
4053 v8::internal::Heap* heap = reinterpret_cast<v8::internal::Isolate*>( | 4053 v8::internal::Heap* heap = reinterpret_cast<v8::internal::Isolate*>( |
4054 iso)->heap(); | 4054 iso)->heap(); |
4055 heap->CollectGarbage(i::NEW_SPACE); | 4055 heap->CollectAllGarbage(i::Heap::kNoGCFlags); |
4056 | 4056 |
4057 // All objects should be alive. | 4057 // All objects should be alive. |
4058 CHECK_EQ(0, counter.NumberOfWeakCalls()); | 4058 CHECK_EQ(0, counter.NumberOfWeakCalls()); |
4059 | 4059 |
4060 // Weaken the root. | 4060 // Weaken the root. |
4061 root.handle.SetWeak(&root, &WeakPointerCallback); | 4061 root.handle.SetWeak(&root, &WeakPointerCallback); |
4062 root.handle.MarkPartiallyDependent(); | 4062 root.handle.MarkPartiallyDependent(); |
4063 | 4063 |
4064 // Groups are deleted, rebuild groups. | 4064 // Groups are deleted, rebuild groups. |
4065 { | 4065 { |
(...skipping 11 matching lines...) Expand all Loading... |
4077 iso->SetObjectGroupId(g2s1.handle, UniqueId(2)); | 4077 iso->SetObjectGroupId(g2s1.handle, UniqueId(2)); |
4078 iso->SetObjectGroupId(g2s2.handle, UniqueId(2)); | 4078 iso->SetObjectGroupId(g2s2.handle, UniqueId(2)); |
4079 Local<Object>::New(iso, g2s1.handle.As<Object>())->Set( | 4079 Local<Object>::New(iso, g2s1.handle.As<Object>())->Set( |
4080 v8_str("x"), Local<Value>::New(iso, g3s1.handle)); | 4080 v8_str("x"), Local<Value>::New(iso, g3s1.handle)); |
4081 iso->SetObjectGroupId(g3s1.handle, UniqueId(3)); | 4081 iso->SetObjectGroupId(g3s1.handle, UniqueId(3)); |
4082 iso->SetObjectGroupId(g3s2.handle, UniqueId(3)); | 4082 iso->SetObjectGroupId(g3s2.handle, UniqueId(3)); |
4083 Local<Object>::New(iso, g3s1.handle.As<Object>())->Set( | 4083 Local<Object>::New(iso, g3s1.handle.As<Object>())->Set( |
4084 v8_str("x"), Local<Value>::New(iso, g1s1.handle)); | 4084 v8_str("x"), Local<Value>::New(iso, g1s1.handle)); |
4085 } | 4085 } |
4086 | 4086 |
4087 heap->CollectGarbage(i::NEW_SPACE); | 4087 heap->CollectAllGarbage(i::Heap::kNoGCFlags); |
4088 | 4088 |
4089 // All objects should be gone. 7 global handles in total. | 4089 // All objects should be gone. 7 global handles in total. |
4090 CHECK_EQ(7, counter.NumberOfWeakCalls()); | 4090 CHECK_EQ(7, counter.NumberOfWeakCalls()); |
4091 } | 4091 } |
4092 | 4092 |
4093 | 4093 |
4094 THREADED_TEST(ScriptException) { | 4094 THREADED_TEST(ScriptException) { |
4095 LocalContext env; | 4095 LocalContext env; |
4096 v8::HandleScope scope(env->GetIsolate()); | 4096 v8::HandleScope scope(env->GetIsolate()); |
4097 Local<Script> script = v8_compile("throw 'panama!';"); | 4097 Local<Script> script = v8_compile("throw 'panama!';"); |
(...skipping 18272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22370 "f.call(friend);"); | 22370 "f.call(friend);"); |
22371 CHECK_EQ(2, named_access_count); | 22371 CHECK_EQ(2, named_access_count); |
22372 | 22372 |
22373 // Test access using Object.setPrototypeOf reflective method. | 22373 // Test access using Object.setPrototypeOf reflective method. |
22374 named_access_count = 0; | 22374 named_access_count = 0; |
22375 CompileRun("Object.setPrototypeOf(friend, {});"); | 22375 CompileRun("Object.setPrototypeOf(friend, {});"); |
22376 CHECK_EQ(1, named_access_count); | 22376 CHECK_EQ(1, named_access_count); |
22377 CompileRun("Object.getPrototypeOf(friend);"); | 22377 CompileRun("Object.getPrototypeOf(friend);"); |
22378 CHECK_EQ(2, named_access_count); | 22378 CHECK_EQ(2, named_access_count); |
22379 } | 22379 } |
OLD | NEW |