Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: test/cctest/test-api.cc

Issue 421313004: Enable ES6 Symbols by default (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/v8natives.js ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 { 2730 {
2731 // Re-attach global proxy to a new context, hash should stay the same. 2731 // Re-attach global proxy to a new context, hash should stay the same.
2732 LocalContext env2(NULL, Handle<ObjectTemplate>(), global_proxy); 2732 LocalContext env2(NULL, Handle<ObjectTemplate>(), global_proxy);
2733 int hash3 = global_proxy->GetIdentityHash(); 2733 int hash3 = global_proxy->GetIdentityHash();
2734 CHECK_EQ(hash1, hash3); 2734 CHECK_EQ(hash1, hash3);
2735 } 2735 }
2736 } 2736 }
2737 2737
2738 2738
2739 THREADED_TEST(SymbolProperties) { 2739 THREADED_TEST(SymbolProperties) {
2740 i::FLAG_harmony_symbols = true;
2741
2742 LocalContext env; 2740 LocalContext env;
2743 v8::Isolate* isolate = env->GetIsolate(); 2741 v8::Isolate* isolate = env->GetIsolate();
2744 v8::HandleScope scope(isolate); 2742 v8::HandleScope scope(isolate);
2745 2743
2746 v8::Local<v8::Object> obj = v8::Object::New(isolate); 2744 v8::Local<v8::Object> obj = v8::Object::New(isolate);
2747 v8::Local<v8::Symbol> sym1 = v8::Symbol::New(isolate); 2745 v8::Local<v8::Symbol> sym1 = v8::Symbol::New(isolate);
2748 v8::Local<v8::Symbol> sym2 = 2746 v8::Local<v8::Symbol> sym2 =
2749 v8::Symbol::New(isolate, v8_str("my-symbol")); 2747 v8::Symbol::New(isolate, v8_str("my-symbol"));
2750 2748
2751 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 2749 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 // Private properties are inherited (for the time being). 2878 // Private properties are inherited (for the time being).
2881 v8::Local<v8::Object> child = v8::Object::New(isolate); 2879 v8::Local<v8::Object> child = v8::Object::New(isolate);
2882 child->SetPrototype(obj); 2880 child->SetPrototype(obj);
2883 CHECK(child->HasPrivate(priv1)); 2881 CHECK(child->HasPrivate(priv1));
2884 CHECK_EQ(2002, child->GetPrivate(priv1)->Int32Value()); 2882 CHECK_EQ(2002, child->GetPrivate(priv1)->Int32Value());
2885 CHECK_EQ(0, child->GetOwnPropertyNames()->Length()); 2883 CHECK_EQ(0, child->GetOwnPropertyNames()->Length());
2886 } 2884 }
2887 2885
2888 2886
2889 THREADED_TEST(GlobalSymbols) { 2887 THREADED_TEST(GlobalSymbols) {
2890 i::FLAG_harmony_symbols = true;
2891
2892 LocalContext env; 2888 LocalContext env;
2893 v8::Isolate* isolate = env->GetIsolate(); 2889 v8::Isolate* isolate = env->GetIsolate();
2894 v8::HandleScope scope(isolate); 2890 v8::HandleScope scope(isolate);
2895 2891
2896 v8::Local<String> name = v8_str("my-symbol"); 2892 v8::Local<String> name = v8_str("my-symbol");
2897 v8::Local<v8::Symbol> glob = v8::Symbol::For(isolate, name); 2893 v8::Local<v8::Symbol> glob = v8::Symbol::For(isolate, name);
2898 v8::Local<v8::Symbol> glob2 = v8::Symbol::For(isolate, name); 2894 v8::Local<v8::Symbol> glob2 = v8::Symbol::For(isolate, name);
2899 CHECK(glob2->SameValue(glob)); 2895 CHECK(glob2->SameValue(glob));
2900 2896
2901 v8::Local<v8::Symbol> glob_api = v8::Symbol::ForApi(isolate, name); 2897 v8::Local<v8::Symbol> glob_api = v8::Symbol::ForApi(isolate, name);
(...skipping 18487 matching lines...) Expand 10 before | Expand all | Expand 10 after
21389 v8::HandleScope scope(isolate); 21385 v8::HandleScope scope(isolate);
21390 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); 21386 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
21391 Local<Object> obj = templ->NewInstance(); 21387 Local<Object> obj = templ->NewInstance();
21392 obj->GetIdentityHash(); 21388 obj->GetIdentityHash();
21393 obj->DeleteHiddenValue(v8_str("Bug")); 21389 obj->DeleteHiddenValue(v8_str("Bug"));
21394 } 21390 }
21395 21391
21396 21392
21397 THREADED_TEST(Regress2535) { 21393 THREADED_TEST(Regress2535) {
21398 i::FLAG_harmony_collections = true; 21394 i::FLAG_harmony_collections = true;
21399 i::FLAG_harmony_symbols = true;
21400 LocalContext context; 21395 LocalContext context;
21401 v8::HandleScope scope(context->GetIsolate()); 21396 v8::HandleScope scope(context->GetIsolate());
21402 Local<Value> set_value = CompileRun("new Set();"); 21397 Local<Value> set_value = CompileRun("new Set();");
21403 Local<Object> set_object(Local<Object>::Cast(set_value)); 21398 Local<Object> set_object(Local<Object>::Cast(set_value));
21404 CHECK_EQ(0, set_object->InternalFieldCount()); 21399 CHECK_EQ(0, set_object->InternalFieldCount());
21405 Local<Value> map_value = CompileRun("new Map();"); 21400 Local<Value> map_value = CompileRun("new Map();");
21406 Local<Object> map_object(Local<Object>::Cast(map_value)); 21401 Local<Object> map_object(Local<Object>::Cast(map_value));
21407 CHECK_EQ(0, map_object->InternalFieldCount()); 21402 CHECK_EQ(0, map_object->InternalFieldCount());
21408 } 21403 }
21409 21404
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
22829 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); 22824 desc = x->GetOwnPropertyDescriptor(v8_str("p1"));
22830 Local<Function> set = 22825 Local<Function> set =
22831 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); 22826 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set")));
22832 Local<Function> get = 22827 Local<Function> get =
22833 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); 22828 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get")));
22834 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); 22829 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL));
22835 Handle<Value> args[] = { v8_num(14) }; 22830 Handle<Value> args[] = { v8_num(14) };
22836 set->Call(x, 1, args); 22831 set->Call(x, 1, args);
22837 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); 22832 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL));
22838 } 22833 }
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698