| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties, | 327 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties, |
| 328 "OptimizeForAdding"); | 328 "OptimizeForAdding"); |
| 329 } | 329 } |
| 330 return *object; | 330 return *object; |
| 331 } | 331 } |
| 332 | 332 |
| 333 | 333 |
| 334 RUNTIME_FUNCTION(Runtime_ObjectFreeze) { | 334 RUNTIME_FUNCTION(Runtime_ObjectFreeze) { |
| 335 HandleScope scope(isolate); | 335 HandleScope scope(isolate); |
| 336 DCHECK(args.length() == 1); | 336 DCHECK(args.length() == 1); |
| 337 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 337 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
| 338 | 338 |
| 339 // %ObjectFreeze is a fast path and these cases are handled elsewhere. | 339 MAYBE_RETURN( |
| 340 RUNTIME_ASSERT(!object->HasSloppyArgumentsElements() && | 340 JSReceiver::SetIntegrityLevel(object, FROZEN, Object::THROW_ON_ERROR), |
| 341 !object->map()->is_observed() && !object->IsJSProxy()); | 341 isolate->heap()->exception()); |
| 342 | 342 return *object; |
| 343 Handle<Object> result; | |
| 344 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, JSObject::Freeze(object)); | |
| 345 return *result; | |
| 346 } | 343 } |
| 347 | 344 |
| 348 | 345 |
| 349 RUNTIME_FUNCTION(Runtime_ObjectSeal) { | 346 RUNTIME_FUNCTION(Runtime_ObjectSeal) { |
| 350 HandleScope scope(isolate); | 347 HandleScope scope(isolate); |
| 351 DCHECK(args.length() == 1); | 348 DCHECK(args.length() == 1); |
| 352 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 349 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
| 353 | 350 |
| 354 // %ObjectSeal is a fast path and these cases are handled elsewhere. | 351 MAYBE_RETURN( |
| 355 RUNTIME_ASSERT(!object->HasSloppyArgumentsElements() && | 352 JSReceiver::SetIntegrityLevel(object, SEALED, Object::THROW_ON_ERROR), |
| 356 !object->map()->is_observed() && !object->IsJSProxy()); | 353 isolate->heap()->exception()); |
| 357 | 354 return *object; |
| 358 Handle<Object> result; | |
| 359 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, JSObject::Seal(object)); | |
| 360 return *result; | |
| 361 } | 355 } |
| 362 | 356 |
| 363 | 357 |
| 364 RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) { | 358 RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) { |
| 365 HandleScope scope(isolate); | 359 HandleScope scope(isolate); |
| 366 DCHECK_EQ(1, args.length()); | 360 DCHECK_EQ(1, args.length()); |
| 367 CONVERT_SMI_ARG_CHECKED(slot, 0); | 361 CONVERT_SMI_ARG_CHECKED(slot, 0); |
| 368 | 362 |
| 369 // Go up context chain to the script context. | 363 // Go up context chain to the script context. |
| 370 Handle<Context> script_context(isolate->context()->script_context(), isolate); | 364 Handle<Context> script_context(isolate->context()->script_context(), isolate); |
| (...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 | 1592 |
| 1599 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1593 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
| 1600 HandleScope scope(isolate); | 1594 HandleScope scope(isolate); |
| 1601 DCHECK(args.length() == 2); | 1595 DCHECK(args.length() == 2); |
| 1602 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1596 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
| 1603 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1597 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
| 1604 return JSReceiver::DefineProperties(isolate, o, properties); | 1598 return JSReceiver::DefineProperties(isolate, o, properties); |
| 1605 } | 1599 } |
| 1606 } // namespace internal | 1600 } // namespace internal |
| 1607 } // namespace v8 | 1601 } // namespace v8 |
| OLD | NEW |