| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 1563 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 1564 if (obj->IsSmi()) return true; | 1564 if (obj->IsSmi()) return true; |
| 1565 if (obj->IsNumber()) { | 1565 if (obj->IsNumber()) { |
| 1566 double value = obj->Number(); | 1566 double value = obj->Number(); |
| 1567 return i::FastI2D(i::FastD2I(value)) == value; | 1567 return i::FastI2D(i::FastD2I(value)) == value; |
| 1568 } | 1568 } |
| 1569 return false; | 1569 return false; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 | 1572 |
| 1573 bool Value::IsUint32() const { |
| 1574 if (IsDeadCheck("v8::Value::IsUint32()")) return false; |
| 1575 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 1576 if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0; |
| 1577 if (obj->IsNumber()) { |
| 1578 double value = obj->Number(); |
| 1579 return i::FastUI2D(i::FastD2UI(value)) == value; |
| 1580 } |
| 1581 return false; |
| 1582 } |
| 1583 |
| 1584 |
| 1573 bool Value::IsDate() const { | 1585 bool Value::IsDate() const { |
| 1574 if (IsDeadCheck("v8::Value::IsDate()")) return false; | 1586 if (IsDeadCheck("v8::Value::IsDate()")) return false; |
| 1575 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 1587 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 1576 return obj->HasSpecificClassOf(i::Heap::Date_symbol()); | 1588 return obj->HasSpecificClassOf(i::Heap::Date_symbol()); |
| 1577 } | 1589 } |
| 1578 | 1590 |
| 1579 | 1591 |
| 1580 Local<String> Value::ToString() const { | 1592 Local<String> Value::ToString() const { |
| 1581 if (IsDeadCheck("v8::Value::ToString()")) return Local<String>(); | 1593 if (IsDeadCheck("v8::Value::ToString()")) return Local<String>(); |
| 1582 LOG_API("ToString"); | 1594 LOG_API("ToString"); |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2721 if (IsDeadCheck("v8::Int32::Value()")) return 0; | 2733 if (IsDeadCheck("v8::Int32::Value()")) return 0; |
| 2722 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2734 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2723 if (obj->IsSmi()) { | 2735 if (obj->IsSmi()) { |
| 2724 return i::Smi::cast(*obj)->value(); | 2736 return i::Smi::cast(*obj)->value(); |
| 2725 } else { | 2737 } else { |
| 2726 return static_cast<int32_t>(obj->Number()); | 2738 return static_cast<int32_t>(obj->Number()); |
| 2727 } | 2739 } |
| 2728 } | 2740 } |
| 2729 | 2741 |
| 2730 | 2742 |
| 2743 uint32_t Uint32::Value() const { |
| 2744 if (IsDeadCheck("v8::Uint32::Value()")) return 0; |
| 2745 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2746 if (obj->IsSmi()) { |
| 2747 return i::Smi::cast(*obj)->value(); |
| 2748 } else { |
| 2749 return static_cast<uint32_t>(obj->Number()); |
| 2750 } |
| 2751 } |
| 2752 |
| 2753 |
| 2731 int v8::Object::InternalFieldCount() { | 2754 int v8::Object::InternalFieldCount() { |
| 2732 if (IsDeadCheck("v8::Object::InternalFieldCount()")) return 0; | 2755 if (IsDeadCheck("v8::Object::InternalFieldCount()")) return 0; |
| 2733 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 2756 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 2734 return obj->GetInternalFieldCount(); | 2757 return obj->GetInternalFieldCount(); |
| 2735 } | 2758 } |
| 2736 | 2759 |
| 2737 | 2760 |
| 2738 Local<Value> v8::Object::CheckedGetInternalField(int index) { | 2761 Local<Value> v8::Object::CheckedGetInternalField(int index) { |
| 2739 if (IsDeadCheck("v8::Object::GetInternalField()")) return Local<Value>(); | 2762 if (IsDeadCheck("v8::Object::GetInternalField()")) return Local<Value>(); |
| 2740 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 2763 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3944 | 3967 |
| 3945 | 3968 |
| 3946 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 3969 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 3947 HandleScopeImplementer* thread_local = | 3970 HandleScopeImplementer* thread_local = |
| 3948 reinterpret_cast<HandleScopeImplementer*>(storage); | 3971 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 3949 thread_local->IterateThis(v); | 3972 thread_local->IterateThis(v); |
| 3950 return storage + ArchiveSpacePerThread(); | 3973 return storage + ArchiveSpacePerThread(); |
| 3951 } | 3974 } |
| 3952 | 3975 |
| 3953 } } // namespace v8::internal | 3976 } } // namespace v8::internal |
| OLD | NEW |