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: rebase 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
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/runtime/runtime-symbol.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 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); 178 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
166 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol(); 179 Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol();
167 // At this point, no revocation has been issued before 180 // At this point, no revocation has been issued before
168 RUNTIME_ASSERT(JSReceiver::GetDataProperty(promise, key)->IsUndefined()); 181 RUNTIME_ASSERT(JSReceiver::GetDataProperty(promise, key)->IsUndefined());
169 isolate->ReportPromiseReject(promise, Handle<Object>(), 182 isolate->ReportPromiseReject(promise, Handle<Object>(),
170 v8::kPromiseHandlerAddedAfterReject); 183 v8::kPromiseHandlerAddedAfterReject);
171 return isolate->heap()->undefined_value(); 184 return isolate->heap()->undefined_value();
172 } 185 }
173 186
174 187
175 RUNTIME_FUNCTION(Runtime_PromiseHasHandlerSymbol) {
176 DCHECK(args.length() == 0);
177 return isolate->heap()->promise_has_handler_symbol();
178 }
179
180
181 RUNTIME_FUNCTION(Runtime_StackGuard) { 188 RUNTIME_FUNCTION(Runtime_StackGuard) {
182 SealHandleScope shs(isolate); 189 SealHandleScope shs(isolate);
183 DCHECK(args.length() == 0); 190 DCHECK(args.length() == 0);
184 191
185 // First check if this is a real stack overflow. 192 // First check if this is a real stack overflow.
186 StackLimitCheck check(isolate); 193 StackLimitCheck check(isolate);
187 if (check.JsHasOverflowed()) { 194 if (check.JsHasOverflowed()) {
188 return isolate->StackOverflow(); 195 return isolate->StackOverflow();
189 } 196 }
190 197
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2); 311 CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2);
305 CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3); 312 CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3);
306 Handle<String> result; 313 Handle<String> result;
307 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 314 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
308 isolate, result, 315 isolate, result,
309 MessageTemplate::FormatMessage(template_index, arg0, arg1, arg2)); 316 MessageTemplate::FormatMessage(template_index, arg0, arg1, arg2));
310 return *result; 317 return *result;
311 } 318 }
312 319
313 320
314 #define CALLSITE_GET(NAME, RETURN) \ 321 #define CALLSITE_GET(NAME, RETURN) \
315 RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \ 322 RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \
316 HandleScope scope(isolate); \ 323 HandleScope scope(isolate); \
317 DCHECK(args.length() == 3); \ 324 DCHECK(args.length() == 1); \
318 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); \ 325 CONVERT_ARG_HANDLE_CHECKED(JSObject, call_site_obj, 0); \
319 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 1); \ 326 Handle<String> result; \
320 CONVERT_INT32_ARG_CHECKED(pos, 2); \ 327 CallSite call_site(isolate, call_site_obj); \
321 Handle<String> result; \ 328 return RETURN(call_site.NAME(), isolate); \
322 CallSite call_site(receiver, fun, pos); \
323 return RETURN(call_site.NAME(isolate), isolate); \
324 } 329 }
325 330
326 static inline Object* ReturnDereferencedHandle(Handle<Object> obj, 331 static inline Object* ReturnDereferencedHandle(Handle<Object> obj,
327 Isolate* isolate) { 332 Isolate* isolate) {
328 return *obj; 333 return *obj;
329 } 334 }
330 335
331 336
332 static inline Object* ReturnPositiveSmiOrNull(int value, Isolate* isolate) { 337 static inline Object* ReturnPositiveSmiOrNull(int value, Isolate* isolate) {
333 if (value >= 0) return Smi::FromInt(value); 338 if (value >= 0) return Smi::FromInt(value);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 413 }
409 414
410 415
411 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) { 416 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) {
412 HandleScope shs(isolate); 417 HandleScope shs(isolate);
413 return isolate->heap()->code_stub_exports_object(); 418 return isolate->heap()->code_stub_exports_object();
414 } 419 }
415 420
416 } // namespace internal 421 } // namespace internal
417 } // namespace v8 422 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/runtime/runtime-symbol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698