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 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 CompileRun( | 2741 CompileRun( |
2742 "function cnst() { return 42; };\n" | 2742 "function cnst() { return 42; };\n" |
2743 "Object.prototype.__defineGetter__('v8::IdentityHash', cnst);\n"); | 2743 "Object.prototype.__defineGetter__('v8::IdentityHash', cnst);\n"); |
2744 Local<v8::Object> o1 = v8::Object::New(isolate); | 2744 Local<v8::Object> o1 = v8::Object::New(isolate); |
2745 Local<v8::Object> o2 = v8::Object::New(isolate); | 2745 Local<v8::Object> o2 = v8::Object::New(isolate); |
2746 CHECK_NE(o1->GetIdentityHash(), o2->GetIdentityHash()); | 2746 CHECK_NE(o1->GetIdentityHash(), o2->GetIdentityHash()); |
2747 } | 2747 } |
2748 } | 2748 } |
2749 | 2749 |
2750 | 2750 |
| 2751 THREADED_TEST(GlobalProxyIdentityHash) { |
| 2752 LocalContext env; |
| 2753 v8::Isolate* isolate = env->GetIsolate(); |
| 2754 v8::HandleScope scope(isolate); |
| 2755 Handle<Object> global_proxy = env->Global(); |
| 2756 int hash1 = global_proxy->GetIdentityHash(); |
| 2757 // Hash should be retained after being detached. |
| 2758 env->DetachGlobal(); |
| 2759 int hash2 = global_proxy->GetIdentityHash(); |
| 2760 CHECK_EQ(hash1, hash2); |
| 2761 { |
| 2762 // Re-attach global proxy to a new context, hash should stay the same. |
| 2763 LocalContext env2(NULL, Handle<ObjectTemplate>(), global_proxy); |
| 2764 int hash3 = global_proxy->GetIdentityHash(); |
| 2765 CHECK_EQ(hash1, hash3); |
| 2766 } |
| 2767 } |
| 2768 |
| 2769 |
2751 THREADED_TEST(SymbolProperties) { | 2770 THREADED_TEST(SymbolProperties) { |
2752 i::FLAG_harmony_symbols = true; | 2771 i::FLAG_harmony_symbols = true; |
2753 | 2772 |
2754 LocalContext env; | 2773 LocalContext env; |
2755 v8::Isolate* isolate = env->GetIsolate(); | 2774 v8::Isolate* isolate = env->GetIsolate(); |
2756 v8::HandleScope scope(isolate); | 2775 v8::HandleScope scope(isolate); |
2757 | 2776 |
2758 v8::Local<v8::Object> obj = v8::Object::New(isolate); | 2777 v8::Local<v8::Object> obj = v8::Object::New(isolate); |
2759 v8::Local<v8::Symbol> sym1 = v8::Symbol::New(isolate); | 2778 v8::Local<v8::Symbol> sym1 = v8::Symbol::New(isolate); |
2760 v8::Local<v8::Symbol> sym2 = | 2779 v8::Local<v8::Symbol> sym2 = |
(...skipping 19725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22486 v8::internal::FLAG_stack_size = 150; | 22505 v8::internal::FLAG_stack_size = 150; |
22487 LocalContext current; | 22506 LocalContext current; |
22488 v8::Isolate* isolate = current->GetIsolate(); | 22507 v8::Isolate* isolate = current->GetIsolate(); |
22489 v8::HandleScope scope(isolate); | 22508 v8::HandleScope scope(isolate); |
22490 V8::SetCaptureStackTraceForUncaughtExceptions( | 22509 V8::SetCaptureStackTraceForUncaughtExceptions( |
22491 true, 10, v8::StackTrace::kDetailed); | 22510 true, 10, v8::StackTrace::kDetailed); |
22492 v8::TryCatch try_catch; | 22511 v8::TryCatch try_catch; |
22493 CompileRun("(function f(x) { f(x+1); })(0)"); | 22512 CompileRun("(function f(x) { f(x+1); })(0)"); |
22494 CHECK(try_catch.HasCaught()); | 22513 CHECK(try_catch.HasCaught()); |
22495 } | 22514 } |
OLD | NEW |