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

Side by Side Diff: src/api.cc

Issue 1378403004: [api] expose Array Iterators to API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased u_u Created 5 years, 2 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 | « include/v8.h ('k') | src/array-iterator.js » ('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 6076 matching lines...) Expand 10 before | Expand all | Expand 10 after
6087 RETURN_ESCAPED(result); 6087 RETURN_ESCAPED(result);
6088 } 6088 }
6089 6089
6090 6090
6091 Local<Object> Array::CloneElementAt(uint32_t index) { 6091 Local<Object> Array::CloneElementAt(uint32_t index) {
6092 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 6092 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
6093 RETURN_TO_LOCAL_UNCHECKED(CloneElementAt(context, index), Object); 6093 RETURN_TO_LOCAL_UNCHECKED(CloneElementAt(context, index), Object);
6094 } 6094 }
6095 6095
6096 6096
6097 Local<Function> Array::GetKeysIterator(Isolate* isolate) {
6098 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6099 i::Handle<i::JSFunction> keys(
6100 i_isolate->native_context()->array_keys_iterator(), i_isolate);
6101 DCHECK(!keys.is_null());
6102 return Utils::ToLocal(keys);
6103 }
6104
6105
6106 Local<Function> Array::GetValuesIterator(Isolate* isolate) {
6107 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6108 i::Handle<i::JSFunction> values(
6109 i_isolate->native_context()->array_values_iterator(), i_isolate);
6110 DCHECK(!values.is_null());
6111 return Utils::ToLocal(values);
6112 }
6113
6114
6115 Local<Function> Array::GetEntriesIterator(Isolate* isolate) {
6116 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6117 i::Handle<i::JSFunction> entries(
6118 i_isolate->native_context()->array_entries_iterator(), i_isolate);
6119 DCHECK(!entries.is_null());
6120 return Utils::ToLocal(entries);
6121 }
6122
6123
6097 Local<v8::Map> v8::Map::New(Isolate* isolate) { 6124 Local<v8::Map> v8::Map::New(Isolate* isolate) {
6098 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6125 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6099 LOG_API(i_isolate, "Map::New"); 6126 LOG_API(i_isolate, "Map::New");
6100 ENTER_V8(i_isolate); 6127 ENTER_V8(i_isolate);
6101 i::Handle<i::JSMap> obj = i_isolate->factory()->NewJSMap(); 6128 i::Handle<i::JSMap> obj = i_isolate->factory()->NewJSMap();
6102 return Utils::ToLocal(obj); 6129 return Utils::ToLocal(obj);
6103 } 6130 }
6104 6131
6105 6132
6106 size_t v8::Map::Size() const { 6133 size_t v8::Map::Size() const {
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
8361 Address callback_address = 8388 Address callback_address =
8362 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8389 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8363 VMState<EXTERNAL> state(isolate); 8390 VMState<EXTERNAL> state(isolate);
8364 ExternalCallbackScope call_scope(isolate, callback_address); 8391 ExternalCallbackScope call_scope(isolate, callback_address);
8365 callback(info); 8392 callback(info);
8366 } 8393 }
8367 8394
8368 8395
8369 } // namespace internal 8396 } // namespace internal
8370 } // namespace v8 8397 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/array-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698