| 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 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 RUNTIME_ASSERT(!obj->IsNull()); | 1448 RUNTIME_ASSERT(!obj->IsNull()); |
| 1449 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 1449 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
| 1450 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); | 1450 CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2); |
| 1451 RUNTIME_ASSERT(IsValidAccessor(getter)); | 1451 RUNTIME_ASSERT(IsValidAccessor(getter)); |
| 1452 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); | 1452 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); |
| 1453 RUNTIME_ASSERT(IsValidAccessor(setter)); | 1453 RUNTIME_ASSERT(IsValidAccessor(setter)); |
| 1454 CONVERT_SMI_ARG_CHECKED(unchecked, 4); | 1454 CONVERT_SMI_ARG_CHECKED(unchecked, 4); |
| 1455 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 1455 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 1456 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 1456 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
| 1457 | 1457 |
| 1458 bool fast = obj->HasFastProperties(); | |
| 1459 RETURN_FAILURE_ON_EXCEPTION( | 1458 RETURN_FAILURE_ON_EXCEPTION( |
| 1460 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attr)); | 1459 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attr)); |
| 1461 if (fast) JSObject::MigrateSlowToFast(obj, 0, "RuntimeDefineAccessor"); | |
| 1462 return isolate->heap()->undefined_value(); | 1460 return isolate->heap()->undefined_value(); |
| 1463 } | 1461 } |
| 1464 | 1462 |
| 1465 | 1463 |
| 1466 // Implements part of 8.12.9 DefineOwnProperty. | 1464 // Implements part of 8.12.9 DefineOwnProperty. |
| 1467 // There are 3 cases that lead here: | 1465 // There are 3 cases that lead here: |
| 1468 // Step 4a - define a new data property. | 1466 // Step 4a - define a new data property. |
| 1469 // Steps 9b & 12 - replace an existing accessor property with a data property. | 1467 // Steps 9b & 12 - replace an existing accessor property with a data property. |
| 1470 // Step 12 - update an existing data property with a data or generic | 1468 // Step 12 - update an existing data property with a data or generic |
| 1471 // descriptor. | 1469 // descriptor. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 | 1578 |
| 1581 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { | 1579 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { |
| 1582 SealHandleScope shs(isolate); | 1580 SealHandleScope shs(isolate); |
| 1583 DCHECK(args.length() == 1); | 1581 DCHECK(args.length() == 1); |
| 1584 CONVERT_ARG_CHECKED(Object, obj, 0); | 1582 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 1585 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); | 1583 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); |
| 1586 return JSReceiver::cast(obj)->class_name(); | 1584 return JSReceiver::cast(obj)->class_name(); |
| 1587 } | 1585 } |
| 1588 } | 1586 } |
| 1589 } // namespace v8::internal | 1587 } // namespace v8::internal |
| OLD | NEW |