OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (IsBoolean()) return IsTrue(); | 112 if (IsBoolean()) return IsTrue(); |
113 if (IsSmi()) return Smi::cast(this)->value() != 0; | 113 if (IsSmi()) return Smi::cast(this)->value() != 0; |
114 if (IsUndefined() || IsNull()) return false; | 114 if (IsUndefined() || IsNull()) return false; |
115 if (IsUndetectableObject()) return false; // Undetectable object is false. | 115 if (IsUndetectableObject()) return false; // Undetectable object is false. |
116 if (IsString()) return String::cast(this)->length() != 0; | 116 if (IsString()) return String::cast(this)->length() != 0; |
117 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); | 117 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 | 121 |
| 122 bool Object::IsCallable() { |
| 123 Object* fun = this; |
| 124 while (fun->IsJSFunctionProxy()) { |
| 125 fun = JSFunctionProxy::cast(fun)->call_trap(); |
| 126 } |
| 127 return fun->IsJSFunction() || |
| 128 (fun->IsHeapObject() && |
| 129 HeapObject::cast(fun)->map()->has_instance_call_handler()); |
| 130 } |
| 131 |
| 132 |
122 void Object::Lookup(Name* name, LookupResult* result) { | 133 void Object::Lookup(Name* name, LookupResult* result) { |
123 Object* holder = NULL; | 134 Object* holder = NULL; |
124 if (IsJSReceiver()) { | 135 if (IsJSReceiver()) { |
125 holder = this; | 136 holder = this; |
126 } else { | 137 } else { |
127 Context* native_context = result->isolate()->context()->native_context(); | 138 Context* native_context = result->isolate()->context()->native_context(); |
128 if (IsNumber()) { | 139 if (IsNumber()) { |
129 holder = native_context->number_function()->instance_prototype(); | 140 holder = native_context->number_function()->instance_prototype(); |
130 } else if (IsString()) { | 141 } else if (IsString()) { |
131 holder = native_context->string_function()->instance_prototype(); | 142 holder = native_context->string_function()->instance_prototype(); |
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2180 | 2191 |
2181 Execution::Call(isolate, | 2192 Execution::Call(isolate, |
2182 Handle<JSFunction>(isolate->observers_notify_change()), | 2193 Handle<JSFunction>(isolate->observers_notify_change()), |
2183 isolate->factory()->undefined_value(), | 2194 isolate->factory()->undefined_value(), |
2184 argc, args, | 2195 argc, args, |
2185 &threw); | 2196 &threw); |
2186 ASSERT(!threw); | 2197 ASSERT(!threw); |
2187 } | 2198 } |
2188 | 2199 |
2189 | 2200 |
2190 void JSObject::DeliverChangeRecords(Isolate* isolate) { | |
2191 ASSERT(isolate->observer_delivery_pending()); | |
2192 bool threw = false; | |
2193 Execution::Call( | |
2194 isolate, | |
2195 isolate->observers_deliver_changes(), | |
2196 isolate->factory()->undefined_value(), | |
2197 0, | |
2198 NULL, | |
2199 &threw); | |
2200 ASSERT(!threw); | |
2201 isolate->set_observer_delivery_pending(false); | |
2202 } | |
2203 | |
2204 | |
2205 Handle<Object> JSObject::SetPropertyPostInterceptor( | 2201 Handle<Object> JSObject::SetPropertyPostInterceptor( |
2206 Handle<JSObject> object, | 2202 Handle<JSObject> object, |
2207 Handle<Name> name, | 2203 Handle<Name> name, |
2208 Handle<Object> value, | 2204 Handle<Object> value, |
2209 PropertyAttributes attributes, | 2205 PropertyAttributes attributes, |
2210 StrictModeFlag strict_mode) { | 2206 StrictModeFlag strict_mode) { |
2211 // Check local property, ignore interceptor. | 2207 // Check local property, ignore interceptor. |
2212 LookupResult result(object->GetIsolate()); | 2208 LookupResult result(object->GetIsolate()); |
2213 object->LocalLookupRealNamedProperty(*name, &result); | 2209 object->LocalLookupRealNamedProperty(*name, &result); |
2214 if (!result.IsFound()) { | 2210 if (!result.IsFound()) { |
(...skipping 14311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16526 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16522 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16527 static const char* error_messages_[] = { | 16523 static const char* error_messages_[] = { |
16528 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16524 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16529 }; | 16525 }; |
16530 #undef ERROR_MESSAGES_TEXTS | 16526 #undef ERROR_MESSAGES_TEXTS |
16531 return error_messages_[reason]; | 16527 return error_messages_[reason]; |
16532 } | 16528 } |
16533 | 16529 |
16534 | 16530 |
16535 } } // namespace v8::internal | 16531 } } // namespace v8::internal |
OLD | NEW |