OLD | NEW |
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/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 DCHECK(args.length() == 1); | 336 DCHECK(args.length() == 1); |
337 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); | 337 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
338 | 338 |
339 MAYBE_RETURN( | 339 MAYBE_RETURN( |
340 JSReceiver::SetIntegrityLevel(object, FROZEN, Object::THROW_ON_ERROR), | 340 JSReceiver::SetIntegrityLevel(object, FROZEN, Object::THROW_ON_ERROR), |
341 isolate->heap()->exception()); | 341 isolate->heap()->exception()); |
342 return *object; | 342 return *object; |
343 } | 343 } |
344 | 344 |
345 | 345 |
| 346 RUNTIME_FUNCTION(Runtime_ObjectIsFrozen) { |
| 347 HandleScope scope(isolate); |
| 348 DCHECK(args.length() == 1); |
| 349 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
| 350 |
| 351 Maybe<bool> result = JSReceiver::TestIntegrityLevel(object, FROZEN); |
| 352 MAYBE_RETURN(result, isolate->heap()->exception()); |
| 353 return isolate->heap()->ToBoolean(result.FromJust()); |
| 354 } |
| 355 |
| 356 |
346 RUNTIME_FUNCTION(Runtime_ObjectSeal) { | 357 RUNTIME_FUNCTION(Runtime_ObjectSeal) { |
347 HandleScope scope(isolate); | 358 HandleScope scope(isolate); |
348 DCHECK(args.length() == 1); | 359 DCHECK(args.length() == 1); |
349 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); | 360 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
350 | 361 |
351 MAYBE_RETURN( | 362 MAYBE_RETURN( |
352 JSReceiver::SetIntegrityLevel(object, SEALED, Object::THROW_ON_ERROR), | 363 JSReceiver::SetIntegrityLevel(object, SEALED, Object::THROW_ON_ERROR), |
353 isolate->heap()->exception()); | 364 isolate->heap()->exception()); |
354 return *object; | 365 return *object; |
355 } | 366 } |
356 | 367 |
357 | 368 |
| 369 RUNTIME_FUNCTION(Runtime_ObjectIsSealed) { |
| 370 HandleScope scope(isolate); |
| 371 DCHECK(args.length() == 1); |
| 372 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
| 373 |
| 374 Maybe<bool> result = JSReceiver::TestIntegrityLevel(object, SEALED); |
| 375 MAYBE_RETURN(result, isolate->heap()->exception()); |
| 376 return isolate->heap()->ToBoolean(result.FromJust()); |
| 377 } |
| 378 |
| 379 |
358 RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) { | 380 RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) { |
359 HandleScope scope(isolate); | 381 HandleScope scope(isolate); |
360 DCHECK_EQ(1, args.length()); | 382 DCHECK_EQ(1, args.length()); |
361 CONVERT_SMI_ARG_CHECKED(slot, 0); | 383 CONVERT_SMI_ARG_CHECKED(slot, 0); |
362 | 384 |
363 // Go up context chain to the script context. | 385 // Go up context chain to the script context. |
364 Handle<Context> script_context(isolate->context()->script_context(), isolate); | 386 Handle<Context> script_context(isolate->context()->script_context(), isolate); |
365 DCHECK(script_context->IsScriptContext()); | 387 DCHECK(script_context->IsScriptContext()); |
366 DCHECK(script_context->get(slot)->IsPropertyCell()); | 388 DCHECK(script_context->get(slot)->IsPropertyCell()); |
367 | 389 |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 | 1434 |
1413 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1435 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
1414 HandleScope scope(isolate); | 1436 HandleScope scope(isolate); |
1415 DCHECK(args.length() == 2); | 1437 DCHECK(args.length() == 2); |
1416 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1438 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1417 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1439 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1418 return JSReceiver::DefineProperties(isolate, o, properties); | 1440 return JSReceiver::DefineProperties(isolate, o, properties); |
1419 } | 1441 } |
1420 } // namespace internal | 1442 } // namespace internal |
1421 } // namespace v8 | 1443 } // namespace v8 |
OLD | NEW |