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 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 | 1470 |
1471 RUNTIME_FUNCTION(Runtime_HasFastPackedElements) { | 1471 RUNTIME_FUNCTION(Runtime_HasFastPackedElements) { |
1472 SealHandleScope shs(isolate); | 1472 SealHandleScope shs(isolate); |
1473 DCHECK(args.length() == 1); | 1473 DCHECK(args.length() == 1); |
1474 CONVERT_ARG_CHECKED(HeapObject, obj, 0); | 1474 CONVERT_ARG_CHECKED(HeapObject, obj, 0); |
1475 return isolate->heap()->ToBoolean( | 1475 return isolate->heap()->ToBoolean( |
1476 IsFastPackedElementsKind(obj->map()->elements_kind())); | 1476 IsFastPackedElementsKind(obj->map()->elements_kind())); |
1477 } | 1477 } |
1478 | 1478 |
1479 | 1479 |
1480 RUNTIME_FUNCTION(RuntimeReference_ValueOf) { | 1480 RUNTIME_FUNCTION(Runtime_ValueOf) { |
1481 SealHandleScope shs(isolate); | 1481 SealHandleScope shs(isolate); |
1482 DCHECK(args.length() == 1); | 1482 DCHECK(args.length() == 1); |
1483 CONVERT_ARG_CHECKED(Object, obj, 0); | 1483 CONVERT_ARG_CHECKED(Object, obj, 0); |
1484 if (!obj->IsJSValue()) return obj; | 1484 if (!obj->IsJSValue()) return obj; |
1485 return JSValue::cast(obj)->value(); | 1485 return JSValue::cast(obj)->value(); |
1486 } | 1486 } |
1487 | 1487 |
1488 | 1488 |
1489 RUNTIME_FUNCTION(RuntimeReference_SetValueOf) { | 1489 RUNTIME_FUNCTION(Runtime_SetValueOf) { |
1490 SealHandleScope shs(isolate); | 1490 SealHandleScope shs(isolate); |
1491 DCHECK(args.length() == 2); | 1491 DCHECK(args.length() == 2); |
1492 CONVERT_ARG_CHECKED(Object, obj, 0); | 1492 CONVERT_ARG_CHECKED(Object, obj, 0); |
1493 CONVERT_ARG_CHECKED(Object, value, 1); | 1493 CONVERT_ARG_CHECKED(Object, value, 1); |
1494 if (!obj->IsJSValue()) return value; | 1494 if (!obj->IsJSValue()) return value; |
1495 JSValue::cast(obj)->set_value(value); | 1495 JSValue::cast(obj)->set_value(value); |
1496 return value; | 1496 return value; |
1497 } | 1497 } |
1498 | 1498 |
1499 | 1499 |
1500 RUNTIME_FUNCTION(RuntimeReference_ObjectEquals) { | 1500 RUNTIME_FUNCTION(Runtime_ObjectEquals) { |
1501 SealHandleScope shs(isolate); | 1501 SealHandleScope shs(isolate); |
1502 DCHECK(args.length() == 2); | 1502 DCHECK(args.length() == 2); |
1503 CONVERT_ARG_CHECKED(Object, obj1, 0); | 1503 CONVERT_ARG_CHECKED(Object, obj1, 0); |
1504 CONVERT_ARG_CHECKED(Object, obj2, 1); | 1504 CONVERT_ARG_CHECKED(Object, obj2, 1); |
1505 return isolate->heap()->ToBoolean(obj1 == obj2); | 1505 return isolate->heap()->ToBoolean(obj1 == obj2); |
1506 } | 1506 } |
1507 | 1507 |
1508 | 1508 |
1509 RUNTIME_FUNCTION(RuntimeReference_IsObject) { | 1509 RUNTIME_FUNCTION(Runtime_IsObject) { |
1510 SealHandleScope shs(isolate); | 1510 SealHandleScope shs(isolate); |
1511 DCHECK(args.length() == 1); | 1511 DCHECK(args.length() == 1); |
1512 CONVERT_ARG_CHECKED(Object, obj, 0); | 1512 CONVERT_ARG_CHECKED(Object, obj, 0); |
1513 if (!obj->IsHeapObject()) return isolate->heap()->false_value(); | 1513 if (!obj->IsHeapObject()) return isolate->heap()->false_value(); |
1514 if (obj->IsNull()) return isolate->heap()->true_value(); | 1514 if (obj->IsNull()) return isolate->heap()->true_value(); |
1515 if (obj->IsUndetectableObject()) return isolate->heap()->false_value(); | 1515 if (obj->IsUndetectableObject()) return isolate->heap()->false_value(); |
1516 Map* map = HeapObject::cast(obj)->map(); | 1516 Map* map = HeapObject::cast(obj)->map(); |
1517 bool is_non_callable_spec_object = | 1517 bool is_non_callable_spec_object = |
1518 map->instance_type() >= FIRST_NONCALLABLE_SPEC_OBJECT_TYPE && | 1518 map->instance_type() >= FIRST_NONCALLABLE_SPEC_OBJECT_TYPE && |
1519 map->instance_type() <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE; | 1519 map->instance_type() <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE; |
1520 return isolate->heap()->ToBoolean(is_non_callable_spec_object); | 1520 return isolate->heap()->ToBoolean(is_non_callable_spec_object); |
1521 } | 1521 } |
1522 | 1522 |
1523 | 1523 |
1524 RUNTIME_FUNCTION(RuntimeReference_IsUndetectableObject) { | 1524 RUNTIME_FUNCTION(Runtime_IsUndetectableObject) { |
1525 SealHandleScope shs(isolate); | 1525 SealHandleScope shs(isolate); |
1526 DCHECK(args.length() == 1); | 1526 DCHECK(args.length() == 1); |
1527 CONVERT_ARG_CHECKED(Object, obj, 0); | 1527 CONVERT_ARG_CHECKED(Object, obj, 0); |
1528 return isolate->heap()->ToBoolean(obj->IsUndetectableObject()); | 1528 return isolate->heap()->ToBoolean(obj->IsUndetectableObject()); |
1529 } | 1529 } |
1530 | 1530 |
1531 | 1531 |
1532 RUNTIME_FUNCTION(RuntimeReference_IsSpecObject) { | 1532 RUNTIME_FUNCTION(Runtime_IsSpecObject) { |
1533 SealHandleScope shs(isolate); | 1533 SealHandleScope shs(isolate); |
1534 DCHECK(args.length() == 1); | 1534 DCHECK(args.length() == 1); |
1535 CONVERT_ARG_CHECKED(Object, obj, 0); | 1535 CONVERT_ARG_CHECKED(Object, obj, 0); |
1536 return isolate->heap()->ToBoolean(obj->IsSpecObject()); | 1536 return isolate->heap()->ToBoolean(obj->IsSpecObject()); |
1537 } | 1537 } |
1538 | 1538 |
1539 | 1539 |
1540 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { | 1540 RUNTIME_FUNCTION(Runtime_ClassOf) { |
1541 SealHandleScope shs(isolate); | 1541 SealHandleScope shs(isolate); |
1542 DCHECK(args.length() == 1); | 1542 DCHECK(args.length() == 1); |
1543 CONVERT_ARG_CHECKED(Object, obj, 0); | 1543 CONVERT_ARG_CHECKED(Object, obj, 0); |
1544 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); | 1544 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); |
1545 return JSReceiver::cast(obj)->class_name(); | 1545 return JSReceiver::cast(obj)->class_name(); |
1546 } | 1546 } |
1547 | 1547 |
1548 | 1548 |
1549 RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) { | 1549 RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) { |
1550 HandleScope scope(isolate); | 1550 HandleScope scope(isolate); |
(...skipping 20 matching lines...) Expand all Loading... |
1571 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 1571 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
1572 | 1572 |
1573 RETURN_FAILURE_ON_EXCEPTION( | 1573 RETURN_FAILURE_ON_EXCEPTION( |
1574 isolate, | 1574 isolate, |
1575 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | 1575 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), |
1576 setter, attrs)); | 1576 setter, attrs)); |
1577 return isolate->heap()->undefined_value(); | 1577 return isolate->heap()->undefined_value(); |
1578 } | 1578 } |
1579 } | 1579 } |
1580 } // namespace v8::internal | 1580 } // namespace v8::internal |
OLD | NEW |