Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(844)

Side by Side Diff: src/stub-cache.cc

Issue 23620036: Refactoring PropertyCallbackInfo & FunctionCallbackInfo, step 1. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: no mips Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 // TODO(rossberg): Support symbols in the API. 1271 // TODO(rossberg): Support symbols in the API.
1272 if (name_handle->IsSymbol()) 1272 if (name_handle->IsSymbol())
1273 return isolate->heap()->no_interceptor_result_sentinel(); 1273 return isolate->heap()->no_interceptor_result_sentinel();
1274 Handle<String> name = Handle<String>::cast(name_handle); 1274 Handle<String> name = Handle<String>::cast(name_handle);
1275 1275
1276 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); 1276 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
1277 v8::NamedPropertyGetterCallback getter = 1277 v8::NamedPropertyGetterCallback getter =
1278 FUNCTION_CAST<v8::NamedPropertyGetterCallback>(getter_address); 1278 FUNCTION_CAST<v8::NamedPropertyGetterCallback>(getter_address);
1279 ASSERT(getter != NULL); 1279 ASSERT(getter != NULL);
1280 1280
1281 Handle<JSObject> receiver = 1281 int this_index = kArgsOffset - PCA::kThisIndex;
1282 args.at<JSObject>(kArgsOffset - PCA::kThisIndex); 1282 int holder_index = kArgsOffset - PCA::kHolderIndex;
1283 Handle<JSObject> holder = 1283 if (PCA::kThisIndex < PCA::kReturnValueOffset)
Michael Starzinger 2013/09/11 09:55:19 Instead of overlaying the indices used for the arg
marja 2013/09/11 16:35:32 Done.
1284 args.at<JSObject>(kArgsOffset - PCA::kHolderIndex); 1284 this_index -= 2;
1285 if (PCA::kHolderIndex < PCA::kReturnValueOffset)
1286 holder_index -= 2;
1287 Handle<JSObject> receiver = args.at<JSObject>(this_index);
1288 Handle<JSObject> holder = args.at<JSObject>(holder_index);
1285 PropertyCallbackArguments callback_args(isolate, 1289 PropertyCallbackArguments callback_args(isolate,
1286 interceptor_info->data(), 1290 interceptor_info->data(),
1287 *receiver, 1291 *receiver,
1288 *holder); 1292 *holder);
1289 { 1293 {
1290 // Use the interceptor getter. 1294 // Use the interceptor getter.
1291 HandleScope scope(isolate); 1295 HandleScope scope(isolate);
1292 v8::Handle<v8::Value> r = 1296 v8::Handle<v8::Value> r =
1293 callback_args.Call(getter, v8::Utils::ToLocal(name)); 1297 callback_args.Call(getter, v8::Utils::ToLocal(name));
1294 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1298 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
(...skipping 28 matching lines...) Expand all
1323 1327
1324 static MaybeObject* LoadWithInterceptor(Arguments* args, 1328 static MaybeObject* LoadWithInterceptor(Arguments* args,
1325 PropertyAttributes* attrs) { 1329 PropertyAttributes* attrs) {
1326 typedef PropertyCallbackArguments PCA; 1330 typedef PropertyCallbackArguments PCA;
1327 static const int kArgsOffset = kAccessorInfoOffsetInInterceptorArgs; 1331 static const int kArgsOffset = kAccessorInfoOffsetInInterceptorArgs;
1328 Handle<Name> name_handle = args->at<Name>(0); 1332 Handle<Name> name_handle = args->at<Name>(0);
1329 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1); 1333 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1);
1330 ASSERT(kArgsOffset == 2); 1334 ASSERT(kArgsOffset == 2);
1331 // No ReturnValue in interceptors. 1335 // No ReturnValue in interceptors.
1332 ASSERT_EQ(kArgsOffset + PCA::kArgsLength - 2, args->length()); 1336 ASSERT_EQ(kArgsOffset + PCA::kArgsLength - 2, args->length());
1333 Handle<JSObject> receiver_handle = 1337 int this_index = kArgsOffset - PCA::kThisIndex;
1334 args->at<JSObject>(kArgsOffset - PCA::kThisIndex); 1338 int holder_index = kArgsOffset - PCA::kHolderIndex;
1335 Handle<JSObject> holder_handle = 1339 if (PCA::kThisIndex < PCA::kReturnValueOffset)
1336 args->at<JSObject>(kArgsOffset - PCA::kHolderIndex); 1340 this_index -= 2;
1341 if (PCA::kHolderIndex < PCA::kReturnValueOffset)
1342 holder_index -= 2;
1343 Handle<JSObject> receiver_handle = args->at<JSObject>(this_index);
1344 Handle<JSObject> holder_handle = args->at<JSObject>(holder_index);
1337 1345
1338 Isolate* isolate = receiver_handle->GetIsolate(); 1346 Isolate* isolate = receiver_handle->GetIsolate();
1339 1347
1340 // TODO(rossberg): Support symbols in the API. 1348 // TODO(rossberg): Support symbols in the API.
1341 if (name_handle->IsSymbol()) 1349 if (name_handle->IsSymbol())
1342 return holder_handle->GetPropertyPostInterceptor( 1350 return holder_handle->GetPropertyPostInterceptor(
1343 *receiver_handle, *name_handle, attrs); 1351 *receiver_handle, *name_handle, attrs);
1344 Handle<String> name = Handle<String>::cast(name_handle); 1352 Handle<String> name = Handle<String>::cast(name_handle);
1345 1353
1346 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); 1354 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 Handle<FunctionTemplateInfo>( 2269 Handle<FunctionTemplateInfo>(
2262 FunctionTemplateInfo::cast(signature->receiver())); 2270 FunctionTemplateInfo::cast(signature->receiver()));
2263 } 2271 }
2264 } 2272 }
2265 2273
2266 is_simple_api_call_ = true; 2274 is_simple_api_call_ = true;
2267 } 2275 }
2268 2276
2269 2277
2270 } } // namespace v8::internal 2278 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698