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

Side by Side Diff: src/api.cc

Issue 1346763005: Revert of [runtime] Initial step towards switching Execution::Call to callable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | src/arm/builtins-arm.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 // 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 4236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4247 i::Handle<i::JSFunction> fun; 4247 i::Handle<i::JSFunction> fun;
4248 if (self->IsJSFunction()) { 4248 if (self->IsJSFunction()) {
4249 fun = i::Handle<i::JSFunction>::cast(self); 4249 fun = i::Handle<i::JSFunction>::cast(self);
4250 } else { 4250 } else {
4251 has_pending_exception = 4251 has_pending_exception =
4252 !i::Execution::GetFunctionDelegate(isolate, self).ToHandle(&fun); 4252 !i::Execution::GetFunctionDelegate(isolate, self).ToHandle(&fun);
4253 RETURN_ON_FAILED_EXECUTION(Value); 4253 RETURN_ON_FAILED_EXECUTION(Value);
4254 recv_obj = self; 4254 recv_obj = self;
4255 } 4255 }
4256 Local<Value> result; 4256 Local<Value> result;
4257 has_pending_exception = !ToLocal<Value>( 4257 has_pending_exception =
4258 i::Execution::Call(isolate, fun, recv_obj, argc, args), &result); 4258 !ToLocal<Value>(
4259 i::Execution::Call(isolate, fun, recv_obj, argc, args, true),
4260 &result);
4259 RETURN_ON_FAILED_EXECUTION(Value); 4261 RETURN_ON_FAILED_EXECUTION(Value);
4260 RETURN_ESCAPED(result); 4262 RETURN_ESCAPED(result);
4261 } 4263 }
4262 4264
4263 4265
4264 Local<v8::Value> Object::CallAsFunction(v8::Local<v8::Value> recv, int argc, 4266 Local<v8::Value> Object::CallAsFunction(v8::Local<v8::Value> recv, int argc,
4265 v8::Local<v8::Value> argv[]) { 4267 v8::Local<v8::Value> argv[]) {
4266 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4268 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4267 Local<Value>* argv_cast = reinterpret_cast<Local<Value>*>(argv); 4269 Local<Value>* argv_cast = reinterpret_cast<Local<Value>*>(argv);
4268 RETURN_TO_LOCAL_UNCHECKED(CallAsFunction(context, recv, argc, argv_cast), 4270 RETURN_TO_LOCAL_UNCHECKED(CallAsFunction(context, recv, argc, argv_cast),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
4356 MaybeLocal<v8::Value> Function::Call(Local<Context> context, 4358 MaybeLocal<v8::Value> Function::Call(Local<Context> context,
4357 v8::Local<v8::Value> recv, int argc, 4359 v8::Local<v8::Value> recv, int argc,
4358 v8::Local<v8::Value> argv[]) { 4360 v8::Local<v8::Value> argv[]) {
4359 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::Call()", Value); 4361 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::Call()", Value);
4360 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 4362 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4361 auto self = Utils::OpenHandle(this); 4363 auto self = Utils::OpenHandle(this);
4362 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); 4364 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
4363 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**)); 4365 STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
4364 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4366 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4365 Local<Value> result; 4367 Local<Value> result;
4366 has_pending_exception = !ToLocal<Value>( 4368 has_pending_exception =
4367 i::Execution::Call(isolate, self, recv_obj, argc, args), &result); 4369 !ToLocal<Value>(
4370 i::Execution::Call(isolate, self, recv_obj, argc, args, true),
4371 &result);
4368 RETURN_ON_FAILED_EXECUTION(Value); 4372 RETURN_ON_FAILED_EXECUTION(Value);
4369 RETURN_ESCAPED(result); 4373 RETURN_ESCAPED(result);
4370 } 4374 }
4371 4375
4372 4376
4373 Local<v8::Value> Function::Call(v8::Local<v8::Value> recv, int argc, 4377 Local<v8::Value> Function::Call(v8::Local<v8::Value> recv, int argc,
4374 v8::Local<v8::Value> argv[]) { 4378 v8::Local<v8::Value> argv[]) {
4375 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4379 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4376 RETURN_TO_LOCAL_UNCHECKED(Call(context, recv, argc, argv), Value); 4380 RETURN_TO_LOCAL_UNCHECKED(Call(context, recv, argc, argv), Value);
4377 } 4381 }
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
6130 } 6134 }
6131 6135
6132 6136
6133 MaybeLocal<Value> Map::Get(Local<Context> context, Local<Value> key) { 6137 MaybeLocal<Value> Map::Get(Local<Context> context, Local<Value> key) {
6134 PREPARE_FOR_EXECUTION(context, "Map::Get", Value); 6138 PREPARE_FOR_EXECUTION(context, "Map::Get", Value);
6135 auto self = Utils::OpenHandle(this); 6139 auto self = Utils::OpenHandle(this);
6136 Local<Value> result; 6140 Local<Value> result;
6137 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; 6141 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
6138 has_pending_exception = 6142 has_pending_exception =
6139 !ToLocal<Value>(i::Execution::Call(isolate, isolate->map_get(), self, 6143 !ToLocal<Value>(i::Execution::Call(isolate, isolate->map_get(), self,
6140 arraysize(argv), argv), 6144 arraysize(argv), argv, false),
6141 &result); 6145 &result);
6142 RETURN_ON_FAILED_EXECUTION(Value); 6146 RETURN_ON_FAILED_EXECUTION(Value);
6143 RETURN_ESCAPED(result); 6147 RETURN_ESCAPED(result);
6144 } 6148 }
6145 6149
6146 6150
6147 MaybeLocal<Map> Map::Set(Local<Context> context, Local<Value> key, 6151 MaybeLocal<Map> Map::Set(Local<Context> context, Local<Value> key,
6148 Local<Value> value) { 6152 Local<Value> value) {
6149 PREPARE_FOR_EXECUTION(context, "Map::Set", Map); 6153 PREPARE_FOR_EXECUTION(context, "Map::Set", Map);
6150 auto self = Utils::OpenHandle(this); 6154 auto self = Utils::OpenHandle(this);
6151 i::Handle<i::Object> result; 6155 i::Handle<i::Object> result;
6152 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key), 6156 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key),
6153 Utils::OpenHandle(*value)}; 6157 Utils::OpenHandle(*value)};
6154 has_pending_exception = !i::Execution::Call(isolate, isolate->map_set(), self, 6158 has_pending_exception =
6155 arraysize(argv), argv) 6159 !i::Execution::Call(isolate, isolate->map_set(), self, arraysize(argv),
6156 .ToHandle(&result); 6160 argv, false).ToHandle(&result);
6157 RETURN_ON_FAILED_EXECUTION(Map); 6161 RETURN_ON_FAILED_EXECUTION(Map);
6158 RETURN_ESCAPED(Local<Map>::Cast(Utils::ToLocal(result))); 6162 RETURN_ESCAPED(Local<Map>::Cast(Utils::ToLocal(result)));
6159 } 6163 }
6160 6164
6161 6165
6162 Maybe<bool> Map::Has(Local<Context> context, Local<Value> key) { 6166 Maybe<bool> Map::Has(Local<Context> context, Local<Value> key) {
6163 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Map::Has", bool); 6167 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Map::Has", bool);
6164 auto self = Utils::OpenHandle(this); 6168 auto self = Utils::OpenHandle(this);
6165 i::Handle<i::Object> result; 6169 i::Handle<i::Object> result;
6166 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; 6170 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
6167 has_pending_exception = !i::Execution::Call(isolate, isolate->map_has(), self, 6171 has_pending_exception =
6168 arraysize(argv), argv) 6172 !i::Execution::Call(isolate, isolate->map_has(), self, arraysize(argv),
6169 .ToHandle(&result); 6173 argv, false).ToHandle(&result);
6170 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 6174 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
6171 return Just(result->IsTrue()); 6175 return Just(result->IsTrue());
6172 } 6176 }
6173 6177
6174 6178
6175 Maybe<bool> Map::Delete(Local<Context> context, Local<Value> key) { 6179 Maybe<bool> Map::Delete(Local<Context> context, Local<Value> key) {
6176 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Map::Delete", bool); 6180 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Map::Delete", bool);
6177 auto self = Utils::OpenHandle(this); 6181 auto self = Utils::OpenHandle(this);
6178 i::Handle<i::Object> result; 6182 i::Handle<i::Object> result;
6179 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; 6183 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
6180 has_pending_exception = !i::Execution::Call(isolate, isolate->map_delete(), 6184 has_pending_exception =
6181 self, arraysize(argv), argv) 6185 !i::Execution::Call(isolate, isolate->map_delete(), self, arraysize(argv),
6182 .ToHandle(&result); 6186 argv, false).ToHandle(&result);
6183 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 6187 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
6184 return Just(result->IsTrue()); 6188 return Just(result->IsTrue());
6185 } 6189 }
6186 6190
6187 6191
6188 Local<Array> Map::AsArray() const { 6192 Local<Array> Map::AsArray() const {
6189 i::Handle<i::JSMap> obj = Utils::OpenHandle(this); 6193 i::Handle<i::JSMap> obj = Utils::OpenHandle(this);
6190 i::Isolate* isolate = obj->GetIsolate(); 6194 i::Isolate* isolate = obj->GetIsolate();
6191 i::Factory* factory = isolate->factory(); 6195 i::Factory* factory = isolate->factory();
6192 LOG_API(isolate, "Map::AsArray"); 6196 LOG_API(isolate, "Map::AsArray");
(...skipping 16 matching lines...) Expand all
6209 MaybeLocal<Map> Map::FromArray(Local<Context> context, Local<Array> array) { 6213 MaybeLocal<Map> Map::FromArray(Local<Context> context, Local<Array> array) {
6210 PREPARE_FOR_EXECUTION(context, "Map::FromArray", Map); 6214 PREPARE_FOR_EXECUTION(context, "Map::FromArray", Map);
6211 if (array->Length() % 2 != 0) { 6215 if (array->Length() % 2 != 0) {
6212 return MaybeLocal<Map>(); 6216 return MaybeLocal<Map>();
6213 } 6217 }
6214 i::Handle<i::Object> result; 6218 i::Handle<i::Object> result;
6215 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*array)}; 6219 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*array)};
6216 has_pending_exception = 6220 has_pending_exception =
6217 !i::Execution::Call(isolate, isolate->map_from_array(), 6221 !i::Execution::Call(isolate, isolate->map_from_array(),
6218 isolate->factory()->undefined_value(), 6222 isolate->factory()->undefined_value(),
6219 arraysize(argv), argv) 6223 arraysize(argv), argv, false).ToHandle(&result);
6220 .ToHandle(&result);
6221 RETURN_ON_FAILED_EXECUTION(Map); 6224 RETURN_ON_FAILED_EXECUTION(Map);
6222 RETURN_ESCAPED(Local<Map>::Cast(Utils::ToLocal(result))); 6225 RETURN_ESCAPED(Local<Map>::Cast(Utils::ToLocal(result)));
6223 } 6226 }
6224 6227
6225 6228
6226 Local<v8::Set> v8::Set::New(Isolate* isolate) { 6229 Local<v8::Set> v8::Set::New(Isolate* isolate) {
6227 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6230 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6228 LOG_API(i_isolate, "Set::New"); 6231 LOG_API(i_isolate, "Set::New");
6229 ENTER_V8(i_isolate); 6232 ENTER_V8(i_isolate);
6230 i::Handle<i::JSSet> obj = i_isolate->factory()->NewJSSet(); 6233 i::Handle<i::JSSet> obj = i_isolate->factory()->NewJSSet();
(...skipping 14 matching lines...) Expand all
6245 ENTER_V8(isolate); 6248 ENTER_V8(isolate);
6246 i::JSSet::Clear(self); 6249 i::JSSet::Clear(self);
6247 } 6250 }
6248 6251
6249 6252
6250 MaybeLocal<Set> Set::Add(Local<Context> context, Local<Value> key) { 6253 MaybeLocal<Set> Set::Add(Local<Context> context, Local<Value> key) {
6251 PREPARE_FOR_EXECUTION(context, "Set::Add", Set); 6254 PREPARE_FOR_EXECUTION(context, "Set::Add", Set);
6252 auto self = Utils::OpenHandle(this); 6255 auto self = Utils::OpenHandle(this);
6253 i::Handle<i::Object> result; 6256 i::Handle<i::Object> result;
6254 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; 6257 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
6255 has_pending_exception = !i::Execution::Call(isolate, isolate->set_add(), self, 6258 has_pending_exception =
6256 arraysize(argv), argv) 6259 !i::Execution::Call(isolate, isolate->set_add(), self, arraysize(argv),
6257 .ToHandle(&result); 6260 argv, false).ToHandle(&result);
6258 RETURN_ON_FAILED_EXECUTION(Set); 6261 RETURN_ON_FAILED_EXECUTION(Set);
6259 RETURN_ESCAPED(Local<Set>::Cast(Utils::ToLocal(result))); 6262 RETURN_ESCAPED(Local<Set>::Cast(Utils::ToLocal(result)));
6260 } 6263 }
6261 6264
6262 6265
6263 Maybe<bool> Set::Has(Local<Context> context, Local<Value> key) { 6266 Maybe<bool> Set::Has(Local<Context> context, Local<Value> key) {
6264 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Set::Has", bool); 6267 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Set::Has", bool);
6265 auto self = Utils::OpenHandle(this); 6268 auto self = Utils::OpenHandle(this);
6266 i::Handle<i::Object> result; 6269 i::Handle<i::Object> result;
6267 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; 6270 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
6268 has_pending_exception = !i::Execution::Call(isolate, isolate->set_has(), self, 6271 has_pending_exception =
6269 arraysize(argv), argv) 6272 !i::Execution::Call(isolate, isolate->set_has(), self, arraysize(argv),
6270 .ToHandle(&result); 6273 argv, false).ToHandle(&result);
6271 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 6274 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
6272 return Just(result->IsTrue()); 6275 return Just(result->IsTrue());
6273 } 6276 }
6274 6277
6275 6278
6276 Maybe<bool> Set::Delete(Local<Context> context, Local<Value> key) { 6279 Maybe<bool> Set::Delete(Local<Context> context, Local<Value> key) {
6277 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Set::Delete", bool); 6280 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Set::Delete", bool);
6278 auto self = Utils::OpenHandle(this); 6281 auto self = Utils::OpenHandle(this);
6279 i::Handle<i::Object> result; 6282 i::Handle<i::Object> result;
6280 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; 6283 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
6281 has_pending_exception = !i::Execution::Call(isolate, isolate->set_delete(), 6284 has_pending_exception =
6282 self, arraysize(argv), argv) 6285 !i::Execution::Call(isolate, isolate->set_delete(), self, arraysize(argv),
6283 .ToHandle(&result); 6286 argv, false).ToHandle(&result);
6284 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 6287 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
6285 return Just(result->IsTrue()); 6288 return Just(result->IsTrue());
6286 } 6289 }
6287 6290
6288 6291
6289 Local<Array> Set::AsArray() const { 6292 Local<Array> Set::AsArray() const {
6290 i::Handle<i::JSSet> obj = Utils::OpenHandle(this); 6293 i::Handle<i::JSSet> obj = Utils::OpenHandle(this);
6291 i::Isolate* isolate = obj->GetIsolate(); 6294 i::Isolate* isolate = obj->GetIsolate();
6292 i::Factory* factory = isolate->factory(); 6295 i::Factory* factory = isolate->factory();
6293 LOG_API(isolate, "Set::AsArray"); 6296 LOG_API(isolate, "Set::AsArray");
(...skipping 13 matching lines...) Expand all
6307 } 6310 }
6308 6311
6309 6312
6310 MaybeLocal<Set> Set::FromArray(Local<Context> context, Local<Array> array) { 6313 MaybeLocal<Set> Set::FromArray(Local<Context> context, Local<Array> array) {
6311 PREPARE_FOR_EXECUTION(context, "Set::FromArray", Set); 6314 PREPARE_FOR_EXECUTION(context, "Set::FromArray", Set);
6312 i::Handle<i::Object> result; 6315 i::Handle<i::Object> result;
6313 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*array)}; 6316 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*array)};
6314 has_pending_exception = 6317 has_pending_exception =
6315 !i::Execution::Call(isolate, isolate->set_from_array(), 6318 !i::Execution::Call(isolate, isolate->set_from_array(),
6316 isolate->factory()->undefined_value(), 6319 isolate->factory()->undefined_value(),
6317 arraysize(argv), argv) 6320 arraysize(argv), argv, false).ToHandle(&result);
6318 .ToHandle(&result);
6319 RETURN_ON_FAILED_EXECUTION(Set); 6321 RETURN_ON_FAILED_EXECUTION(Set);
6320 RETURN_ESCAPED(Local<Set>::Cast(Utils::ToLocal(result))); 6322 RETURN_ESCAPED(Local<Set>::Cast(Utils::ToLocal(result)));
6321 } 6323 }
6322 6324
6323 6325
6324 bool Value::IsPromise() const { 6326 bool Value::IsPromise() const {
6325 auto self = Utils::OpenHandle(this); 6327 auto self = Utils::OpenHandle(this);
6326 return i::Object::IsPromise(self); 6328 return i::Object::IsPromise(self);
6327 } 6329 }
6328 6330
6329 6331
6330 MaybeLocal<Promise::Resolver> Promise::Resolver::New(Local<Context> context) { 6332 MaybeLocal<Promise::Resolver> Promise::Resolver::New(Local<Context> context) {
6331 PREPARE_FOR_EXECUTION(context, "Promise::Resolver::New", Resolver); 6333 PREPARE_FOR_EXECUTION(context, "Promise::Resolver::New", Resolver);
6332 i::Handle<i::Object> result; 6334 i::Handle<i::Object> result;
6333 has_pending_exception = 6335 has_pending_exception = !i::Execution::Call(
6334 !i::Execution::Call(isolate, isolate->promise_create(), 6336 isolate,
6335 isolate->factory()->undefined_value(), 0, NULL) 6337 isolate->promise_create(),
6336 .ToHandle(&result); 6338 isolate->factory()->undefined_value(),
6339 0, NULL,
6340 false).ToHandle(&result);
6337 RETURN_ON_FAILED_EXECUTION(Promise::Resolver); 6341 RETURN_ON_FAILED_EXECUTION(Promise::Resolver);
6338 RETURN_ESCAPED(Local<Promise::Resolver>::Cast(Utils::ToLocal(result))); 6342 RETURN_ESCAPED(Local<Promise::Resolver>::Cast(Utils::ToLocal(result)));
6339 } 6343 }
6340 6344
6341 6345
6342 Local<Promise::Resolver> Promise::Resolver::New(Isolate* isolate) { 6346 Local<Promise::Resolver> Promise::Resolver::New(Isolate* isolate) {
6343 RETURN_TO_LOCAL_UNCHECKED(New(isolate->GetCurrentContext()), 6347 RETURN_TO_LOCAL_UNCHECKED(New(isolate->GetCurrentContext()),
6344 Promise::Resolver); 6348 Promise::Resolver);
6345 } 6349 }
6346 6350
6347 6351
6348 Local<Promise> Promise::Resolver::GetPromise() { 6352 Local<Promise> Promise::Resolver::GetPromise() {
6349 i::Handle<i::JSObject> promise = Utils::OpenHandle(this); 6353 i::Handle<i::JSObject> promise = Utils::OpenHandle(this);
6350 return Local<Promise>::Cast(Utils::ToLocal(promise)); 6354 return Local<Promise>::Cast(Utils::ToLocal(promise));
6351 } 6355 }
6352 6356
6353 6357
6354 Maybe<bool> Promise::Resolver::Resolve(Local<Context> context, 6358 Maybe<bool> Promise::Resolver::Resolve(Local<Context> context,
6355 Local<Value> value) { 6359 Local<Value> value) {
6356 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Promise::Resolver::Resolve", bool); 6360 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Promise::Resolver::Resolve", bool);
6357 auto self = Utils::OpenHandle(this); 6361 auto self = Utils::OpenHandle(this);
6358 i::Handle<i::Object> argv[] = {self, Utils::OpenHandle(*value)}; 6362 i::Handle<i::Object> argv[] = {self, Utils::OpenHandle(*value)};
6359 has_pending_exception = 6363 has_pending_exception = i::Execution::Call(
6360 i::Execution::Call(isolate, isolate->promise_resolve(), 6364 isolate,
6361 isolate->factory()->undefined_value(), arraysize(argv), 6365 isolate->promise_resolve(),
6362 argv) 6366 isolate->factory()->undefined_value(),
6363 .is_null(); 6367 arraysize(argv), argv,
6368 false).is_null();
6364 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 6369 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
6365 return Just(true); 6370 return Just(true);
6366 } 6371 }
6367 6372
6368 6373
6369 void Promise::Resolver::Resolve(Local<Value> value) { 6374 void Promise::Resolver::Resolve(Local<Value> value) {
6370 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 6375 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
6371 USE(Resolve(context, value)); 6376 USE(Resolve(context, value));
6372 } 6377 }
6373 6378
6374 6379
6375 Maybe<bool> Promise::Resolver::Reject(Local<Context> context, 6380 Maybe<bool> Promise::Resolver::Reject(Local<Context> context,
6376 Local<Value> value) { 6381 Local<Value> value) {
6377 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Promise::Resolver::Resolve", bool); 6382 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "Promise::Resolver::Resolve", bool);
6378 auto self = Utils::OpenHandle(this); 6383 auto self = Utils::OpenHandle(this);
6379 i::Handle<i::Object> argv[] = {self, Utils::OpenHandle(*value)}; 6384 i::Handle<i::Object> argv[] = {self, Utils::OpenHandle(*value)};
6380 has_pending_exception = 6385 has_pending_exception = i::Execution::Call(
6381 i::Execution::Call(isolate, isolate->promise_reject(), 6386 isolate,
6382 isolate->factory()->undefined_value(), arraysize(argv), 6387 isolate->promise_reject(),
6383 argv) 6388 isolate->factory()->undefined_value(),
6384 .is_null(); 6389 arraysize(argv), argv,
6390 false).is_null();
6385 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 6391 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
6386 return Just(true); 6392 return Just(true);
6387 } 6393 }
6388 6394
6389 6395
6390 void Promise::Resolver::Reject(Local<Value> value) { 6396 void Promise::Resolver::Reject(Local<Value> value) {
6391 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 6397 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
6392 USE(Reject(context, value)); 6398 USE(Reject(context, value));
6393 } 6399 }
6394 6400
6395 6401
6396 MaybeLocal<Promise> Promise::Chain(Local<Context> context, 6402 MaybeLocal<Promise> Promise::Chain(Local<Context> context,
6397 Local<Function> handler) { 6403 Local<Function> handler) {
6398 PREPARE_FOR_EXECUTION(context, "Promise::Chain", Promise); 6404 PREPARE_FOR_EXECUTION(context, "Promise::Chain", Promise);
6399 auto self = Utils::OpenHandle(this); 6405 auto self = Utils::OpenHandle(this);
6400 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*handler)}; 6406 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*handler)};
6401 i::Handle<i::Object> result; 6407 i::Handle<i::Object> result;
6402 has_pending_exception = !i::Execution::Call(isolate, isolate->promise_chain(), 6408 has_pending_exception =
6403 self, arraysize(argv), argv) 6409 !i::Execution::Call(isolate, isolate->promise_chain(), self,
6404 .ToHandle(&result); 6410 arraysize(argv), argv, false).ToHandle(&result);
6405 RETURN_ON_FAILED_EXECUTION(Promise); 6411 RETURN_ON_FAILED_EXECUTION(Promise);
6406 RETURN_ESCAPED(Local<Promise>::Cast(Utils::ToLocal(result))); 6412 RETURN_ESCAPED(Local<Promise>::Cast(Utils::ToLocal(result)));
6407 } 6413 }
6408 6414
6409 6415
6410 Local<Promise> Promise::Chain(Local<Function> handler) { 6416 Local<Promise> Promise::Chain(Local<Function> handler) {
6411 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 6417 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
6412 RETURN_TO_LOCAL_UNCHECKED(Chain(context, handler), Promise); 6418 RETURN_TO_LOCAL_UNCHECKED(Chain(context, handler), Promise);
6413 } 6419 }
6414 6420
6415 6421
6416 MaybeLocal<Promise> Promise::Catch(Local<Context> context, 6422 MaybeLocal<Promise> Promise::Catch(Local<Context> context,
6417 Local<Function> handler) { 6423 Local<Function> handler) {
6418 PREPARE_FOR_EXECUTION(context, "Promise::Catch", Promise); 6424 PREPARE_FOR_EXECUTION(context, "Promise::Catch", Promise);
6419 auto self = Utils::OpenHandle(this); 6425 auto self = Utils::OpenHandle(this);
6420 i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) }; 6426 i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) };
6421 i::Handle<i::Object> result; 6427 i::Handle<i::Object> result;
6422 has_pending_exception = !i::Execution::Call(isolate, isolate->promise_catch(), 6428 has_pending_exception =
6423 self, arraysize(argv), argv) 6429 !i::Execution::Call(isolate, isolate->promise_catch(), self,
6424 .ToHandle(&result); 6430 arraysize(argv), argv, false).ToHandle(&result);
6425 RETURN_ON_FAILED_EXECUTION(Promise); 6431 RETURN_ON_FAILED_EXECUTION(Promise);
6426 RETURN_ESCAPED(Local<Promise>::Cast(Utils::ToLocal(result))); 6432 RETURN_ESCAPED(Local<Promise>::Cast(Utils::ToLocal(result)));
6427 } 6433 }
6428 6434
6429 6435
6430 Local<Promise> Promise::Catch(Local<Function> handler) { 6436 Local<Promise> Promise::Catch(Local<Function> handler) {
6431 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 6437 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
6432 RETURN_TO_LOCAL_UNCHECKED(Catch(context, handler), Promise); 6438 RETURN_TO_LOCAL_UNCHECKED(Catch(context, handler), Promise);
6433 } 6439 }
6434 6440
6435 6441
6436 MaybeLocal<Promise> Promise::Then(Local<Context> context, 6442 MaybeLocal<Promise> Promise::Then(Local<Context> context,
6437 Local<Function> handler) { 6443 Local<Function> handler) {
6438 PREPARE_FOR_EXECUTION(context, "Promise::Then", Promise); 6444 PREPARE_FOR_EXECUTION(context, "Promise::Then", Promise);
6439 auto self = Utils::OpenHandle(this); 6445 auto self = Utils::OpenHandle(this);
6440 i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) }; 6446 i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) };
6441 i::Handle<i::Object> result; 6447 i::Handle<i::Object> result;
6442 has_pending_exception = !i::Execution::Call(isolate, isolate->promise_then(), 6448 has_pending_exception =
6443 self, arraysize(argv), argv) 6449 !i::Execution::Call(isolate, isolate->promise_then(), self,
6444 .ToHandle(&result); 6450 arraysize(argv), argv, false).ToHandle(&result);
6445 RETURN_ON_FAILED_EXECUTION(Promise); 6451 RETURN_ON_FAILED_EXECUTION(Promise);
6446 RETURN_ESCAPED(Local<Promise>::Cast(Utils::ToLocal(result))); 6452 RETURN_ESCAPED(Local<Promise>::Cast(Utils::ToLocal(result)));
6447 } 6453 }
6448 6454
6449 6455
6450 Local<Promise> Promise::Then(Local<Function> handler) { 6456 Local<Promise> Promise::Then(Local<Function> handler) {
6451 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 6457 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
6452 RETURN_TO_LOCAL_UNCHECKED(Then(context, handler), Promise); 6458 RETURN_TO_LOCAL_UNCHECKED(Then(context, handler), Promise);
6453 } 6459 }
6454 6460
(...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after
8381 Address callback_address = 8387 Address callback_address =
8382 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8388 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8383 VMState<EXTERNAL> state(isolate); 8389 VMState<EXTERNAL> state(isolate);
8384 ExternalCallbackScope call_scope(isolate, callback_address); 8390 ExternalCallbackScope call_scope(isolate, callback_address);
8385 callback(info); 8391 callback(info);
8386 } 8392 }
8387 8393
8388 8394
8389 } // namespace internal 8395 } // namespace internal
8390 } // namespace v8 8396 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/arm/builtins-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698