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/v8.h" | 5 #include "src/v8.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.h" | 9 #include "src/debug.h" |
10 #include "src/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1437 // There are 3 cases that lead here: | 1437 // There are 3 cases that lead here: |
1438 // Step 4b - define a new accessor property. | 1438 // Step 4b - define a new accessor property. |
1439 // Steps 9c & 12 - replace an existing data property with an accessor property. | 1439 // Steps 9c & 12 - replace an existing data property with an accessor property. |
1440 // Step 12 - update an existing accessor property with an accessor or generic | 1440 // Step 12 - update an existing accessor property with an accessor or generic |
1441 // descriptor. | 1441 // descriptor. |
1442 RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) { | 1442 RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) { |
1443 HandleScope scope(isolate); | 1443 HandleScope scope(isolate); |
1444 DCHECK(args.length() == 5); | 1444 DCHECK(args.length() == 5); |
1445 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1445 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
1446 RUNTIME_ASSERT(!obj->IsNull()); | 1446 RUNTIME_ASSERT(!obj->IsNull()); |
1447 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 1447 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
arv (Not doing code reviews)
2014/12/10 23:38:13
revert this. handle ToName in caller instead.
arv (Not doing code reviews)
2014/12/11 23:10:34
Done.
| |
1448 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); | 1448 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); |
1449 RUNTIME_ASSERT(IsValidAccessor(getter)); | 1449 RUNTIME_ASSERT(IsValidAccessor(getter)); |
1450 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); | 1450 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); |
1451 RUNTIME_ASSERT(IsValidAccessor(setter)); | 1451 RUNTIME_ASSERT(IsValidAccessor(setter)); |
1452 CONVERT_SMI_ARG_CHECKED(unchecked, 4); | 1452 CONVERT_SMI_ARG_CHECKED(unchecked, 4); |
1453 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 1453 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
1454 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 1454 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
1455 | 1455 |
1456 Handle<Name> name; | |
1457 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, | |
1458 Runtime::ToName(isolate, key)); | |
1456 RETURN_FAILURE_ON_EXCEPTION( | 1459 RETURN_FAILURE_ON_EXCEPTION( |
1457 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attr)); | 1460 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attr)); |
1458 return isolate->heap()->undefined_value(); | 1461 return isolate->heap()->undefined_value(); |
1459 } | 1462 } |
1460 | 1463 |
1461 | 1464 |
1462 // Implements part of 8.12.9 DefineOwnProperty. | 1465 // Implements part of 8.12.9 DefineOwnProperty. |
1463 // There are 3 cases that lead here: | 1466 // There are 3 cases that lead here: |
1464 // Step 4a - define a new data property. | 1467 // Step 4a - define a new data property. |
1465 // Steps 9b & 12 - replace an existing accessor property with a data property. | 1468 // Steps 9b & 12 - replace an existing accessor property with a data property. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1585 | 1588 |
1586 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { | 1589 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { |
1587 SealHandleScope shs(isolate); | 1590 SealHandleScope shs(isolate); |
1588 DCHECK(args.length() == 1); | 1591 DCHECK(args.length() == 1); |
1589 CONVERT_ARG_CHECKED(Object, obj, 0); | 1592 CONVERT_ARG_CHECKED(Object, obj, 0); |
1590 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); | 1593 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); |
1591 return JSReceiver::cast(obj)->class_name(); | 1594 return JSReceiver::cast(obj)->class_name(); |
1592 } | 1595 } |
1593 } | 1596 } |
1594 } // namespace v8::internal | 1597 } // namespace v8::internal |
OLD | NEW |