OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 "v8::GetIndexedPropertiesExternalArrayDataLength()", | 3248 "v8::GetIndexedPropertiesExternalArrayDataLength()", |
3249 return 0); | 3249 return 0); |
3250 if (self->HasExternalArrayElements()) { | 3250 if (self->HasExternalArrayElements()) { |
3251 return i::ExternalArray::cast(self->elements())->length(); | 3251 return i::ExternalArray::cast(self->elements())->length(); |
3252 } else { | 3252 } else { |
3253 return -1; | 3253 return -1; |
3254 } | 3254 } |
3255 } | 3255 } |
3256 | 3256 |
3257 | 3257 |
| 3258 Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc, |
| 3259 v8::Handle<v8::Value> argv[]) { |
| 3260 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3261 ON_BAILOUT(isolate, "v8::Object::CallAsFunction()", |
| 3262 return Local<v8::Value>()); |
| 3263 LOG_API(isolate, "Object::CallAsFunction"); |
| 3264 ENTER_V8(isolate); |
| 3265 HandleScope scope; |
| 3266 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 3267 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); |
| 3268 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |
| 3269 i::Object*** args = reinterpret_cast<i::Object***>(argv); |
| 3270 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>(); |
| 3271 if (obj->IsJSFunction()) { |
| 3272 fun = i::Handle<i::JSFunction>::cast(obj); |
| 3273 } else { |
| 3274 EXCEPTION_PREAMBLE(isolate); |
| 3275 i::Handle<i::Object> delegate = |
| 3276 i::Execution::TryGetFunctionDelegate(obj, &has_pending_exception); |
| 3277 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
| 3278 fun = i::Handle<i::JSFunction>::cast(delegate); |
| 3279 recv_obj = obj; |
| 3280 } |
| 3281 EXCEPTION_PREAMBLE(isolate); |
| 3282 i::Handle<i::Object> returned = |
| 3283 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); |
| 3284 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
| 3285 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned))); |
| 3286 } |
| 3287 |
| 3288 |
3258 Local<v8::Object> Function::NewInstance() const { | 3289 Local<v8::Object> Function::NewInstance() const { |
3259 return NewInstance(0, NULL); | 3290 return NewInstance(0, NULL); |
3260 } | 3291 } |
3261 | 3292 |
3262 | 3293 |
3263 Local<v8::Object> Function::NewInstance(int argc, | 3294 Local<v8::Object> Function::NewInstance(int argc, |
3264 v8::Handle<v8::Value> argv[]) const { | 3295 v8::Handle<v8::Value> argv[]) const { |
3265 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3296 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3266 ON_BAILOUT(isolate, "v8::Function::NewInstance()", | 3297 ON_BAILOUT(isolate, "v8::Function::NewInstance()", |
3267 return Local<v8::Object>()); | 3298 return Local<v8::Object>()); |
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5761 | 5792 |
5762 | 5793 |
5763 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5794 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5764 HandleScopeImplementer* scope_implementer = | 5795 HandleScopeImplementer* scope_implementer = |
5765 reinterpret_cast<HandleScopeImplementer*>(storage); | 5796 reinterpret_cast<HandleScopeImplementer*>(storage); |
5766 scope_implementer->IterateThis(v); | 5797 scope_implementer->IterateThis(v); |
5767 return storage + ArchiveSpacePerThread(); | 5798 return storage + ArchiveSpacePerThread(); |
5768 } | 5799 } |
5769 | 5800 |
5770 } } // namespace v8::internal | 5801 } } // namespace v8::internal |
OLD | NEW |