| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (IsBoolean()) return IsTrue(); | 85 if (IsBoolean()) return IsTrue(); |
| 86 if (IsSmi()) return Smi::cast(this)->value() != 0; | 86 if (IsSmi()) return Smi::cast(this)->value() != 0; |
| 87 if (IsUndefined() || IsNull()) return false; | 87 if (IsUndefined() || IsNull()) return false; |
| 88 if (IsUndetectableObject()) return false; // Undetectable object is false. | 88 if (IsUndetectableObject()) return false; // Undetectable object is false. |
| 89 if (IsString()) return String::cast(this)->length() != 0; | 89 if (IsString()) return String::cast(this)->length() != 0; |
| 90 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); | 90 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); |
| 91 return true; | 91 return true; |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| 95 bool Object::IsCallable() { | 95 bool Object::IsCallable() const { |
| 96 Object* fun = this; | 96 const Object* fun = this; |
| 97 while (fun->IsJSFunctionProxy()) { | 97 while (fun->IsJSFunctionProxy()) { |
| 98 fun = JSFunctionProxy::cast(fun)->call_trap(); | 98 fun = JSFunctionProxy::cast(fun)->call_trap(); |
| 99 } | 99 } |
| 100 return fun->IsJSFunction() || | 100 return fun->IsJSFunction() || |
| 101 (fun->IsHeapObject() && | 101 (fun->IsHeapObject() && |
| 102 HeapObject::cast(fun)->map()->has_instance_call_handler()); | 102 HeapObject::cast(fun)->map()->has_instance_call_handler()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 void Object::Lookup(Handle<Name> name, LookupResult* result) { | 106 void Object::Lookup(Handle<Name> name, LookupResult* result) { |
| (...skipping 16851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16958 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16958 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16959 static const char* error_messages_[] = { | 16959 static const char* error_messages_[] = { |
| 16960 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16960 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16961 }; | 16961 }; |
| 16962 #undef ERROR_MESSAGES_TEXTS | 16962 #undef ERROR_MESSAGES_TEXTS |
| 16963 return error_messages_[reason]; | 16963 return error_messages_[reason]; |
| 16964 } | 16964 } |
| 16965 | 16965 |
| 16966 | 16966 |
| 16967 } } // namespace v8::internal | 16967 } } // namespace v8::internal |
| OLD | NEW |