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

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

Issue 1159433003: Use GetProperty for getting elements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments 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/utils.h ('k') | test/cctest/test-api-interceptors.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 7415 matching lines...) Expand 10 before | Expand all | Expand 10 after
7426 v8::Handle<String> str = v8_str("42"); 7426 v8::Handle<String> str = v8_str("42");
7427 v8::Handle<v8::Uint32> index = str->ToArrayIndex(); 7427 v8::Handle<v8::Uint32> index = str->ToArrayIndex();
7428 CHECK(!index.IsEmpty()); 7428 CHECK(!index.IsEmpty());
7429 CHECK_EQ(42.0, index->Uint32Value()); 7429 CHECK_EQ(42.0, index->Uint32Value());
7430 str = v8_str("42asdf"); 7430 str = v8_str("42asdf");
7431 index = str->ToArrayIndex(); 7431 index = str->ToArrayIndex();
7432 CHECK(index.IsEmpty()); 7432 CHECK(index.IsEmpty());
7433 str = v8_str("-42"); 7433 str = v8_str("-42");
7434 index = str->ToArrayIndex(); 7434 index = str->ToArrayIndex();
7435 CHECK(index.IsEmpty()); 7435 CHECK(index.IsEmpty());
7436 str = v8_str("4294967295"); 7436 str = v8_str("4294967294");
7437 index = str->ToArrayIndex(); 7437 index = str->ToArrayIndex();
7438 CHECK(!index.IsEmpty()); 7438 CHECK(!index.IsEmpty());
7439 CHECK_EQ(4294967295.0, index->Uint32Value()); 7439 CHECK_EQ(4294967294.0, index->Uint32Value());
7440 v8::Handle<v8::Number> num = v8::Number::New(isolate, 1); 7440 v8::Handle<v8::Number> num = v8::Number::New(isolate, 1);
7441 index = num->ToArrayIndex(); 7441 index = num->ToArrayIndex();
7442 CHECK(!index.IsEmpty()); 7442 CHECK(!index.IsEmpty());
7443 CHECK_EQ(1.0, index->Uint32Value()); 7443 CHECK_EQ(1.0, index->Uint32Value());
7444 num = v8::Number::New(isolate, -1); 7444 num = v8::Number::New(isolate, -1);
7445 index = num->ToArrayIndex(); 7445 index = num->ToArrayIndex();
7446 CHECK(index.IsEmpty()); 7446 CHECK(index.IsEmpty());
7447 v8::Handle<v8::Object> obj = v8::Object::New(isolate); 7447 v8::Handle<v8::Object> obj = v8::Object::New(isolate);
7448 index = obj->ToArrayIndex(); 7448 index = obj->ToArrayIndex();
7449 CHECK(index.IsEmpty()); 7449 CHECK(index.IsEmpty());
(...skipping 13967 matching lines...) Expand 10 before | Expand all | Expand 10 after
21417 CHECK_EQ(2, set->Size()); 21417 CHECK_EQ(2, set->Size());
21418 21418
21419 v8::Local<v8::Array> keys = set->AsArray(); 21419 v8::Local<v8::Array> keys = set->AsArray();
21420 CHECK_EQ(2, keys->Length()); 21420 CHECK_EQ(2, keys->Length());
21421 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); 21421 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value());
21422 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); 21422 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value());
21423 21423
21424 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); 21424 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked();
21425 CHECK_EQ(2, set->Size()); 21425 CHECK_EQ(2, set->Size());
21426 } 21426 }
OLDNEW
« no previous file with comments | « src/utils.h ('k') | test/cctest/test-api-interceptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698