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

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

Issue 118553003: Upgrade Symbol implementation to match current ES6 behavior. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Allow valueOf()/toString() to be called over Symbol values. Created 6 years, 10 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
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 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 v8::Local<v8::Value> sym_val = sym2; 2780 v8::Local<v8::Value> sym_val = sym2;
2781 CHECK(sym_val->IsSymbol()); 2781 CHECK(sym_val->IsSymbol());
2782 CHECK(sym_val->Equals(sym2)); 2782 CHECK(sym_val->Equals(sym2));
2783 CHECK(sym_val->StrictEquals(sym2)); 2783 CHECK(sym_val->StrictEquals(sym2));
2784 CHECK(v8::Symbol::Cast(*sym_val)->Equals(sym2)); 2784 CHECK(v8::Symbol::Cast(*sym_val)->Equals(sym2));
2785 2785
2786 v8::Local<v8::Value> sym_obj = v8::SymbolObject::New(isolate, sym2); 2786 v8::Local<v8::Value> sym_obj = v8::SymbolObject::New(isolate, sym2);
2787 CHECK(sym_obj->IsSymbolObject()); 2787 CHECK(sym_obj->IsSymbolObject());
2788 CHECK(!sym2->IsSymbolObject()); 2788 CHECK(!sym2->IsSymbolObject());
2789 CHECK(!obj->IsSymbolObject()); 2789 CHECK(!obj->IsSymbolObject());
2790 CHECK(sym_obj->Equals(sym2)); 2790 // Comparing Symbol wrapper with Symbol will throw when
2791 // ToPrimitive() is attempted performed on the wrapper.
2792 {
2793 v8::TryCatch try_catch;
2794 sym_obj->Equals(sym2);
2795 CHECK(try_catch.HasCaught());
2796 }
2791 CHECK(!sym_obj->StrictEquals(sym2)); 2797 CHECK(!sym_obj->StrictEquals(sym2));
2792 CHECK(v8::SymbolObject::Cast(*sym_obj)->Equals(sym_obj)); 2798 CHECK(v8::SymbolObject::Cast(*sym_obj)->Equals(sym_obj));
2793 CHECK(v8::SymbolObject::Cast(*sym_obj)->ValueOf()->Equals(sym2)); 2799 CHECK(v8::SymbolObject::Cast(*sym_obj)->ValueOf()->Equals(sym2));
2794 2800
2795 // Make sure delete of a non-existent symbol property works. 2801 // Make sure delete of a non-existent symbol property works.
2796 CHECK(obj->Delete(sym1)); 2802 CHECK(obj->Delete(sym1));
2797 CHECK(!obj->Has(sym1)); 2803 CHECK(!obj->Has(sym1));
2798 2804
2799 CHECK(obj->Set(sym1, v8::Integer::New(isolate, 1503))); 2805 CHECK(obj->Set(sym1, v8::Integer::New(isolate, 1503)));
2800 CHECK(obj->Has(sym1)); 2806 CHECK(obj->Has(sym1));
(...skipping 19176 matching lines...) Expand 10 before | Expand all | Expand 10 after
21977 21983
21978 21984
21979 TEST(TestFunctionCallOptimization) { 21985 TEST(TestFunctionCallOptimization) {
21980 i::FLAG_allow_natives_syntax = true; 21986 i::FLAG_allow_natives_syntax = true;
21981 ApiCallOptimizationChecker checker; 21987 ApiCallOptimizationChecker checker;
21982 checker.Run(true, true); 21988 checker.Run(true, true);
21983 checker.Run(false, true); 21989 checker.Run(false, true);
21984 checker.Run(true, false); 21990 checker.Run(true, false);
21985 checker.Run(false, false); 21991 checker.Run(false, false);
21986 } 21992 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698