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

Side by Side Diff: src/api.cc

Issue 895053002: Move the contents of api-natives.js to c++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/api-natives.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
11 #include <cmath> // For isnan. 11 #include <cmath> // For isnan.
12 #include "include/v8-debug.h" 12 #include "include/v8-debug.h"
13 #include "include/v8-profiler.h" 13 #include "include/v8-profiler.h"
14 #include "include/v8-testing.h" 14 #include "include/v8-testing.h"
15 #include "src/api-natives.h"
15 #include "src/assert-scope.h" 16 #include "src/assert-scope.h"
16 #include "src/background-parsing-task.h" 17 #include "src/background-parsing-task.h"
17 #include "src/base/functional.h" 18 #include "src/base/functional.h"
18 #include "src/base/platform/platform.h" 19 #include "src/base/platform/platform.h"
19 #include "src/base/platform/time.h" 20 #include "src/base/platform/time.h"
20 #include "src/base/utils/random-number-generator.h" 21 #include "src/base/utils/random-number-generator.h"
21 #include "src/bootstrapper.h" 22 #include "src/bootstrapper.h"
22 #include "src/code-stubs.h" 23 #include "src/code-stubs.h"
23 #include "src/compiler.h" 24 #include "src/compiler.h"
24 #include "src/conversions-inl.h" 25 #include "src/conversions-inl.h"
(...skipping 5186 matching lines...) Expand 10 before | Expand all | Expand 10 after
5211 5212
5212 Local<v8::Object> ObjectTemplate::NewInstance() { 5213 Local<v8::Object> ObjectTemplate::NewInstance() {
5213 i::Handle<i::ObjectTemplateInfo> info = Utils::OpenHandle(this); 5214 i::Handle<i::ObjectTemplateInfo> info = Utils::OpenHandle(this);
5214 i::Isolate* isolate = info->GetIsolate(); 5215 i::Isolate* isolate = info->GetIsolate();
5215 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", 5216 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()",
5216 return Local<v8::Object>()); 5217 return Local<v8::Object>());
5217 LOG_API(isolate, "ObjectTemplate::NewInstance"); 5218 LOG_API(isolate, "ObjectTemplate::NewInstance");
5218 ENTER_V8(isolate); 5219 ENTER_V8(isolate);
5219 EXCEPTION_PREAMBLE(isolate); 5220 EXCEPTION_PREAMBLE(isolate);
5220 i::Handle<i::Object> obj; 5221 i::Handle<i::Object> obj;
5221 has_pending_exception = !i::Execution::InstantiateObject(info).ToHandle(&obj); 5222 has_pending_exception =
5223 !i::ApiNatives::InstantiateObject(info).ToHandle(&obj);
5222 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); 5224 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>());
5223 return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj)); 5225 return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj));
5224 } 5226 }
5225 5227
5226 5228
5227 Local<v8::Function> FunctionTemplate::GetFunction() { 5229 Local<v8::Function> FunctionTemplate::GetFunction() {
5228 i::Handle<i::FunctionTemplateInfo> info = Utils::OpenHandle(this); 5230 i::Handle<i::FunctionTemplateInfo> info = Utils::OpenHandle(this);
5229 i::Isolate* isolate = info->GetIsolate(); 5231 i::Isolate* isolate = info->GetIsolate();
5230 ON_BAILOUT(isolate, "v8::FunctionTemplate::GetFunction()", 5232 ON_BAILOUT(isolate, "v8::FunctionTemplate::GetFunction()",
5231 return Local<v8::Function>()); 5233 return Local<v8::Function>());
5232 LOG_API(isolate, "FunctionTemplate::GetFunction"); 5234 LOG_API(isolate, "FunctionTemplate::GetFunction");
5233 ENTER_V8(isolate); 5235 ENTER_V8(isolate);
5234 EXCEPTION_PREAMBLE(isolate); 5236 EXCEPTION_PREAMBLE(isolate);
5235 i::Handle<i::Object> obj; 5237 i::Handle<i::Object> obj;
5236 has_pending_exception = 5238 has_pending_exception =
5237 !i::Execution::InstantiateFunction(info).ToHandle(&obj); 5239 !i::ApiNatives::InstantiateFunction(info).ToHandle(&obj);
5238 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>()); 5240 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>());
5239 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); 5241 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj));
5240 } 5242 }
5241 5243
5242 5244
5243 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { 5245 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) {
5244 i::Handle<i::FunctionTemplateInfo> info = Utils::OpenHandle(this); 5246 i::Handle<i::FunctionTemplateInfo> info = Utils::OpenHandle(this);
5245 i::Isolate* isolate = info->GetIsolate(); 5247 i::Isolate* isolate = info->GetIsolate();
5246 ON_BAILOUT(isolate, "v8::FunctionTemplate::HasInstanceOf()", return false); 5248 ON_BAILOUT(isolate, "v8::FunctionTemplate::HasInstanceOf()", return false);
5247 i::Object* obj = *Utils::OpenHandle(*value); 5249 i::Object* obj = *Utils::OpenHandle(*value);
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after
7635 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7637 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7636 Address callback_address = 7638 Address callback_address =
7637 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7639 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7638 VMState<EXTERNAL> state(isolate); 7640 VMState<EXTERNAL> state(isolate);
7639 ExternalCallbackScope call_scope(isolate, callback_address); 7641 ExternalCallbackScope call_scope(isolate, callback_address);
7640 callback(info); 7642 callback(info);
7641 } 7643 }
7642 7644
7643 7645
7644 } } // namespace v8::internal 7646 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/api-natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698