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