Chromium Code Reviews| 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 3244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3255 } | 3255 } |
| 3256 | 3256 |
| 3257 | 3257 |
| 3258 Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc, | 3258 Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc, |
| 3259 v8::Handle<v8::Value> argv[]) { | 3259 v8::Handle<v8::Value> argv[]) { |
| 3260 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3260 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3261 ON_BAILOUT(isolate, "v8::Object::CallAsFunction()", | 3261 ON_BAILOUT(isolate, "v8::Object::CallAsFunction()", |
| 3262 return Local<v8::Value>()); | 3262 return Local<v8::Value>()); |
| 3263 LOG_API(isolate, "Object::CallAsFunction"); | 3263 LOG_API(isolate, "Object::CallAsFunction"); |
| 3264 ENTER_V8(isolate); | 3264 ENTER_V8(isolate); |
| 3265 HandleScope scope; | 3265 i::HandleScope scope(isolate); |
| 3266 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 3266 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 3267 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); | 3267 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); |
| 3268 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); | 3268 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |
| 3269 i::Object*** args = reinterpret_cast<i::Object***>(argv); | 3269 i::Object*** args = reinterpret_cast<i::Object***>(argv); |
| 3270 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>(); | 3270 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>(); |
| 3271 if (obj->IsJSFunction()) { | 3271 if (obj->IsJSFunction()) { |
| 3272 fun = i::Handle<i::JSFunction>::cast(obj); | 3272 fun = i::Handle<i::JSFunction>::cast(obj); |
| 3273 } else { | 3273 } else { |
| 3274 EXCEPTION_PREAMBLE(isolate); | 3274 EXCEPTION_PREAMBLE(isolate); |
| 3275 i::Handle<i::Object> delegate = | 3275 i::Handle<i::Object> delegate = |
| 3276 i::Execution::TryGetFunctionDelegate(obj, &has_pending_exception); | 3276 i::Execution::TryGetFunctionDelegate(obj, &has_pending_exception); |
| 3277 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 3277 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
| 3278 fun = i::Handle<i::JSFunction>::cast(delegate); | 3278 fun = i::Handle<i::JSFunction>::cast(delegate); |
| 3279 recv_obj = obj; | 3279 recv_obj = obj; |
| 3280 } | 3280 } |
| 3281 EXCEPTION_PREAMBLE(isolate); | 3281 EXCEPTION_PREAMBLE(isolate); |
| 3282 i::Handle<i::Object> returned = | 3282 i::Handle<i::Object> returned = |
| 3283 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); | 3283 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); |
| 3284 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 3284 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
| 3285 return scope.Close(Utils::ToLocal(returned)); | 3285 return Utils::ToLocal(scope.CloseAndEscape(returned)); |
| 3286 } | 3286 } |
| 3287 | 3287 |
| 3288 | 3288 |
| 3289 Local<v8::Value> Object::CallAsConstructor(int argc, | |
| 3290 v8::Handle<v8::Value> argv[]) { | |
| 3291 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | |
| 3292 ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()", | |
| 3293 return Local<v8::Object>()); | |
| 3294 LOG_API(isolate, "Object::CallAsConstructor"); | |
| 3295 ENTER_V8(isolate); | |
| 3296 i::HandleScope scope(isolate); | |
| 3297 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | |
| 3298 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); | |
| 3299 i::Object*** args = reinterpret_cast<i::Object***>(argv); | |
| 3300 i::Handle<i::Object> returned; | |
|
Mads Ager (chromium)
2011/05/06 10:41:47
I would move these to where they are used. I'll ta
| |
| 3301 i::Handle<i::JSFunction> fun; | |
| 3302 if (obj->IsJSFunction()) { | |
| 3303 EXCEPTION_PREAMBLE(isolate); | |
| 3304 fun = i::Handle<i::JSFunction>::cast(obj); | |
| 3305 returned = i::Execution::New(fun, argc, args, &has_pending_exception); | |
| 3306 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | |
| 3307 return Utils::ToLocal(scope.CloseAndEscape( | |
| 3308 i::Handle<i::JSObject>::cast(returned))); | |
|
Mads Ager (chromium)
2011/05/06 10:41:47
I would format this differently. I'll take care of
| |
| 3309 } | |
| 3310 EXCEPTION_PREAMBLE(isolate); | |
| 3311 i::Handle<i::Object> delegate = | |
| 3312 i::Execution::TryGetConstructorDelegate(obj, &has_pending_exception); | |
| 3313 if (!delegate->IsUndefined()) { | |
| 3314 fun = i::Handle<i::JSFunction>::cast(delegate); | |
| 3315 returned = | |
| 3316 i::Execution::Call(fun, obj, argc, args, &has_pending_exception); | |
| 3317 } | |
| 3318 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | |
| 3319 ASSERT(!delegate->IsUndefined()); | |
| 3320 return Utils::ToLocal(scope.CloseAndEscape(returned)); | |
| 3321 } | |
| 3322 | |
| 3323 | |
| 3289 Local<v8::Object> Function::NewInstance() const { | 3324 Local<v8::Object> Function::NewInstance() const { |
| 3290 return NewInstance(0, NULL); | 3325 return NewInstance(0, NULL); |
| 3291 } | 3326 } |
| 3292 | 3327 |
| 3293 | 3328 |
| 3294 Local<v8::Object> Function::NewInstance(int argc, | 3329 Local<v8::Object> Function::NewInstance(int argc, |
| 3295 v8::Handle<v8::Value> argv[]) const { | 3330 v8::Handle<v8::Value> argv[]) const { |
| 3296 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3331 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3297 ON_BAILOUT(isolate, "v8::Function::NewInstance()", | 3332 ON_BAILOUT(isolate, "v8::Function::NewInstance()", |
| 3298 return Local<v8::Object>()); | 3333 return Local<v8::Object>()); |
| (...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5792 | 5827 |
| 5793 | 5828 |
| 5794 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5829 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 5795 HandleScopeImplementer* scope_implementer = | 5830 HandleScopeImplementer* scope_implementer = |
| 5796 reinterpret_cast<HandleScopeImplementer*>(storage); | 5831 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 5797 scope_implementer->IterateThis(v); | 5832 scope_implementer->IterateThis(v); |
| 5798 return storage + ArchiveSpacePerThread(); | 5833 return storage + ArchiveSpacePerThread(); |
| 5799 } | 5834 } |
| 5800 | 5835 |
| 5801 } } // namespace v8::internal | 5836 } } // namespace v8::internal |
| OLD | NEW |