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

Side by Side Diff: src/api.cc

Issue 1456923003: [api] Remove deprecated and unused Set/Map::FromArray (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « include/v8.h ('k') | src/contexts.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 6295 matching lines...) Expand 10 before | Expand all | Expand 10 after
6306 if (table->KeyAt(i)->IsTheHole()) continue; 6306 if (table->KeyAt(i)->IsTheHole()) continue;
6307 result->set(i * 2, table->KeyAt(i)); 6307 result->set(i * 2, table->KeyAt(i));
6308 result->set(i * 2 + 1, table->ValueAt(i)); 6308 result->set(i * 2 + 1, table->ValueAt(i));
6309 } 6309 }
6310 i::Handle<i::JSArray> result_array = 6310 i::Handle<i::JSArray> result_array =
6311 factory->NewJSArrayWithElements(result, i::FAST_ELEMENTS, length); 6311 factory->NewJSArrayWithElements(result, i::FAST_ELEMENTS, length);
6312 return Utils::ToLocal(result_array); 6312 return Utils::ToLocal(result_array);
6313 } 6313 }
6314 6314
6315 6315
6316 MaybeLocal<Map> Map::FromArray(Local<Context> context, Local<Array> array) {
6317 PREPARE_FOR_EXECUTION(context, "Map::FromArray", Map);
6318 if (array->Length() % 2 != 0) {
6319 return MaybeLocal<Map>();
6320 }
6321 i::Handle<i::Object> result;
6322 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*array)};
6323 has_pending_exception =
6324 !i::Execution::Call(isolate, isolate->map_from_array(),
6325 isolate->factory()->undefined_value(),
6326 arraysize(argv), argv)
6327 .ToHandle(&result);
6328 RETURN_ON_FAILED_EXECUTION(Map);
6329 RETURN_ESCAPED(Local<Map>::Cast(Utils::ToLocal(result)));
6330 }
6331
6332
6333 Local<v8::Set> v8::Set::New(Isolate* isolate) { 6316 Local<v8::Set> v8::Set::New(Isolate* isolate) {
6334 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6317 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6335 LOG_API(i_isolate, "Set::New"); 6318 LOG_API(i_isolate, "Set::New");
6336 ENTER_V8(i_isolate); 6319 ENTER_V8(i_isolate);
6337 i::Handle<i::JSSet> obj = i_isolate->factory()->NewJSSet(); 6320 i::Handle<i::JSSet> obj = i_isolate->factory()->NewJSSet();
6338 return Utils::ToLocal(obj); 6321 return Utils::ToLocal(obj);
6339 } 6322 }
6340 6323
6341 6324
6342 size_t v8::Set::Size() const { 6325 size_t v8::Set::Size() const {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
6407 if (!key->IsTheHole()) { 6390 if (!key->IsTheHole()) {
6408 result->set(i, key); 6391 result->set(i, key);
6409 } 6392 }
6410 } 6393 }
6411 i::Handle<i::JSArray> result_array = 6394 i::Handle<i::JSArray> result_array =
6412 factory->NewJSArrayWithElements(result, i::FAST_ELEMENTS, length); 6395 factory->NewJSArrayWithElements(result, i::FAST_ELEMENTS, length);
6413 return Utils::ToLocal(result_array); 6396 return Utils::ToLocal(result_array);
6414 } 6397 }
6415 6398
6416 6399
6417 MaybeLocal<Set> Set::FromArray(Local<Context> context, Local<Array> array) {
6418 PREPARE_FOR_EXECUTION(context, "Set::FromArray", Set);
6419 i::Handle<i::Object> result;
6420 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*array)};
6421 has_pending_exception =
6422 !i::Execution::Call(isolate, isolate->set_from_array(),
6423 isolate->factory()->undefined_value(),
6424 arraysize(argv), argv)
6425 .ToHandle(&result);
6426 RETURN_ON_FAILED_EXECUTION(Set);
6427 RETURN_ESCAPED(Local<Set>::Cast(Utils::ToLocal(result)));
6428 }
6429
6430
6431 bool Value::IsPromise() const { 6400 bool Value::IsPromise() const {
6432 auto self = Utils::OpenHandle(this); 6401 auto self = Utils::OpenHandle(this);
6433 return i::Object::IsPromise(self); 6402 return i::Object::IsPromise(self);
6434 } 6403 }
6435 6404
6436 6405
6437 MaybeLocal<Promise::Resolver> Promise::Resolver::New(Local<Context> context) { 6406 MaybeLocal<Promise::Resolver> Promise::Resolver::New(Local<Context> context) {
6438 PREPARE_FOR_EXECUTION(context, "Promise::Resolver::New", Resolver); 6407 PREPARE_FOR_EXECUTION(context, "Promise::Resolver::New", Resolver);
6439 i::Handle<i::Object> result; 6408 i::Handle<i::Object> result;
6440 has_pending_exception = 6409 has_pending_exception =
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after
8528 Address callback_address = 8497 Address callback_address =
8529 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8498 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8530 VMState<EXTERNAL> state(isolate); 8499 VMState<EXTERNAL> state(isolate);
8531 ExternalCallbackScope call_scope(isolate, callback_address); 8500 ExternalCallbackScope call_scope(isolate, callback_address);
8532 callback(info); 8501 callback(info);
8533 } 8502 }
8534 8503
8535 8504
8536 } // namespace internal 8505 } // namespace internal
8537 } // namespace v8 8506 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698