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

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

Issue 1172683003: Use the LookupIterator for SetElement and friends (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 6 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-heap.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 13248 matching lines...) Expand 10 before | Expand all | Expand 10 after
13259 // Accessors 13259 // Accessors
13260 CHECK_EQ(0, force_set_set_count); 13260 CHECK_EQ(0, force_set_set_count);
13261 CHECK_EQ(0, force_set_get_count); 13261 CHECK_EQ(0, force_set_get_count);
13262 CHECK_EQ(3, global->Get(access_property)->Int32Value()); 13262 CHECK_EQ(3, global->Get(access_property)->Int32Value());
13263 // CHECK_EQ the property shouldn't override it, just call the setter 13263 // CHECK_EQ the property shouldn't override it, just call the setter
13264 // which in this case does nothing. 13264 // which in this case does nothing.
13265 global->Set(access_property, v8::Int32::New(isolate, 7)); 13265 global->Set(access_property, v8::Int32::New(isolate, 7));
13266 CHECK_EQ(3, global->Get(access_property)->Int32Value()); 13266 CHECK_EQ(3, global->Get(access_property)->Int32Value());
13267 CHECK_EQ(1, force_set_set_count); 13267 CHECK_EQ(1, force_set_set_count);
13268 CHECK_EQ(2, force_set_get_count); 13268 CHECK_EQ(2, force_set_get_count);
13269 // Forcing the property to be set should override the accessor without 13269 // ForceSet does not remove the accessors, but rather calls the setter.
13270 // calling it
13271 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); 13270 global->ForceSet(access_property, v8::Int32::New(isolate, 8));
13272 CHECK_EQ(8, global->Get(access_property)->Int32Value()); 13271 CHECK_EQ(3, global->Get(access_property)->Int32Value());
13273 CHECK_EQ(1, force_set_set_count); 13272 CHECK_EQ(2, force_set_set_count);
13274 CHECK_EQ(2, force_set_get_count); 13273 CHECK_EQ(3, force_set_get_count);
13275 } 13274 }
13276 13275
13277 13276
13278 TEST(ForceSetWithInterceptor) { 13277 TEST(ForceSetWithInterceptor) {
13279 force_set_get_count = 0; 13278 force_set_get_count = 0;
13280 force_set_set_count = 0; 13279 force_set_set_count = 0;
13281 pass_on_get = false; 13280 pass_on_get = false;
13282 13281
13283 v8::Isolate* isolate = CcTest::isolate(); 13282 v8::Isolate* isolate = CcTest::isolate();
13284 v8::HandleScope scope(isolate); 13283 v8::HandleScope scope(isolate);
(...skipping 8241 matching lines...) Expand 10 before | Expand all | Expand 10 after
21526 CHECK_EQ(2U, set->Size()); 21525 CHECK_EQ(2U, set->Size());
21527 21526
21528 v8::Local<v8::Array> keys = set->AsArray(); 21527 v8::Local<v8::Array> keys = set->AsArray();
21529 CHECK_EQ(2U, keys->Length()); 21528 CHECK_EQ(2U, keys->Length());
21530 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); 21529 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value());
21531 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); 21530 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value());
21532 21531
21533 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); 21532 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked();
21534 CHECK_EQ(2U, set->Size()); 21533 CHECK_EQ(2U, set->Size());
21535 } 21534 }
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698