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

Side by Side Diff: src/runtime/runtime-internal.cc

Issue 1293493004: Unify symbols sharing across native scripts and runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
11 #include "src/frames-inl.h" 11 #include "src/frames-inl.h"
12 #include "src/messages.h" 12 #include "src/messages.h"
13 #include "src/parser.h" 13 #include "src/parser.h"
14 #include "src/prettyprinter.h" 14 #include "src/prettyprinter.h"
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 18
19 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { 19 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) {
20 SealHandleScope shs(isolate); 20 SealHandleScope shs(isolate);
21 DCHECK(args.length() == 0); 21 DCHECK(args.length() == 0);
22 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); 22 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
23 return isolate->heap()->undefined_value(); 23 return isolate->heap()->undefined_value();
24 } 24 }
25 25
26 26
27 RUNTIME_FUNCTION(Runtime_ExportPrivateSymbols) {
28 HandleScope scope(isolate);
29 DCHECK(args.length() == 1);
30 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
31 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
32 JSObject::NormalizeProperties(container, KEEP_INOBJECT_PROPERTIES, 10,
33 "ExportPrivateSymbols");
34 Bootstrapper::ExportPrivateSymbols(isolate, container);
35 JSObject::MigrateSlowToFast(container, 0, "ExportPrivateSymbols");
36 return *container;
37 }
38
39
27 RUNTIME_FUNCTION(Runtime_ImportToRuntime) { 40 RUNTIME_FUNCTION(Runtime_ImportToRuntime) {
28 HandleScope scope(isolate); 41 HandleScope scope(isolate);
29 DCHECK(args.length() == 1); 42 DCHECK(args.length() == 1);
30 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); 43 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
31 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); 44 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
32 Bootstrapper::ImportNatives(isolate, container); 45 Bootstrapper::ImportNatives(isolate, container);
33 return isolate->heap()->undefined_value(); 46 return isolate->heap()->undefined_value();
34 } 47 }
35 48
36 49
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); 168 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
156 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); 169 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol();
157 // At this point, no revocation has been issued before 170 // At this point, no revocation has been issued before
158 RUNTIME_ASSERT(JSReceiver::GetDataProperty(promise, key)->IsUndefined()); 171 RUNTIME_ASSERT(JSReceiver::GetDataProperty(promise, key)->IsUndefined());
159 isolate->ReportPromiseReject(promise, Handle<Object>(), 172 isolate->ReportPromiseReject(promise, Handle<Object>(),
160 v8::kPromiseHandlerAddedAfterReject); 173 v8::kPromiseHandlerAddedAfterReject);
161 return isolate->heap()->undefined_value(); 174 return isolate->heap()->undefined_value();
162 } 175 }
163 176
164 177
165 RUNTIME_FUNCTION(Runtime_PromiseHasHandlerSymbol) {
166 DCHECK(args.length() == 0);
167 return isolate->heap()->promise_has_handler_symbol();
168 }
169
170
171 RUNTIME_FUNCTION(Runtime_StackGuard) { 178 RUNTIME_FUNCTION(Runtime_StackGuard) {
172 SealHandleScope shs(isolate); 179 SealHandleScope shs(isolate);
173 DCHECK(args.length() == 0); 180 DCHECK(args.length() == 0);
174 181
175 // First check if this is a real stack overflow. 182 // First check if this is a real stack overflow.
176 StackLimitCheck check(isolate); 183 StackLimitCheck check(isolate);
177 if (check.JsHasOverflowed()) { 184 if (check.JsHasOverflowed()) {
178 return isolate->StackOverflow(); 185 return isolate->StackOverflow();
179 } 186 }
180 187
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2); 301 CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2);
295 CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3); 302 CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3);
296 Handle<String> result; 303 Handle<String> result;
297 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 304 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
298 isolate, result, 305 isolate, result,
299 MessageTemplate::FormatMessage(template_index, arg0, arg1, arg2)); 306 MessageTemplate::FormatMessage(template_index, arg0, arg1, arg2));
300 return *result; 307 return *result;
301 } 308 }
302 309
303 310
304 #define CALLSITE_GET(NAME, RETURN) \ 311 #define CALLSITE_GET(NAME, RETURN) \
305 RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \ 312 RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \
306 HandleScope scope(isolate); \ 313 HandleScope scope(isolate); \
307 DCHECK(args.length() == 3); \ 314 DCHECK(args.length() == 1); \
308 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); \ 315 CONVERT_ARG_HANDLE_CHECKED(JSObject, call_site_obj, 0); \
309 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 1); \ 316 Handle<String> result; \
310 CONVERT_INT32_ARG_CHECKED(pos, 2); \ 317 CallSite call_site(isolate, call_site_obj); \
311 Handle<String> result; \ 318 return RETURN(call_site.NAME(), isolate); \
312 CallSite call_site(receiver, fun, pos); \
313 return RETURN(call_site.NAME(isolate), isolate); \
314 } 319 }
315 320
316 static inline Object* ReturnDereferencedHandle(Handle<Object> obj, 321 static inline Object* ReturnDereferencedHandle(Handle<Object> obj,
317 Isolate* isolate) { 322 Isolate* isolate) {
318 return *obj; 323 return *obj;
319 } 324 }
320 325
321 326
322 static inline Object* ReturnPositiveSmiOrNull(int value, Isolate* isolate) { 327 static inline Object* ReturnPositiveSmiOrNull(int value, Isolate* isolate) {
323 if (value >= 0) return Smi::FromInt(value); 328 if (value >= 0) return Smi::FromInt(value);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 403 }
399 404
400 405
401 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) { 406 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) {
402 HandleScope shs(isolate); 407 HandleScope shs(isolate);
403 return isolate->heap()->code_stub_exports_object(); 408 return isolate->heap()->code_stub_exports_object();
404 } 409 }
405 410
406 } // namespace internal 411 } // namespace internal
407 } // namespace v8 412 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698