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

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

Issue 6756029: Clean up runtime functions. (Closed)
Patch Set: Removed the underscore Created 9 years, 8 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
« no previous file with comments | « src/stub-cache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 } 1270 }
1271 } 1271 }
1272 } 1272 }
1273 } 1273 }
1274 1274
1275 1275
1276 // ------------------------------------------------------------------------ 1276 // ------------------------------------------------------------------------
1277 // StubCompiler implementation. 1277 // StubCompiler implementation.
1278 1278
1279 1279
1280 MaybeObject* LoadCallbackProperty(RUNTIME_CALLING_CONVENTION) { 1280 RUNTIME_FUNCTION(MaybeObject*, LoadCallbackProperty) {
1281 RUNTIME_GET_ISOLATE;
1282 ASSERT(args[0]->IsJSObject()); 1281 ASSERT(args[0]->IsJSObject());
1283 ASSERT(args[1]->IsJSObject()); 1282 ASSERT(args[1]->IsJSObject());
1284 AccessorInfo* callback = AccessorInfo::cast(args[3]); 1283 AccessorInfo* callback = AccessorInfo::cast(args[3]);
1285 Address getter_address = v8::ToCData<Address>(callback->getter()); 1284 Address getter_address = v8::ToCData<Address>(callback->getter());
1286 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); 1285 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address);
1287 ASSERT(fun != NULL); 1286 ASSERT(fun != NULL);
1288 v8::AccessorInfo info(&args[0]); 1287 v8::AccessorInfo info(&args[0]);
1289 HandleScope scope(isolate); 1288 HandleScope scope(isolate);
1290 v8::Handle<v8::Value> result; 1289 v8::Handle<v8::Value> result;
1291 { 1290 {
1292 // Leaving JavaScript. 1291 // Leaving JavaScript.
1293 VMState state(isolate, EXTERNAL); 1292 VMState state(isolate, EXTERNAL);
1294 ExternalCallbackScope call_scope(isolate, getter_address); 1293 ExternalCallbackScope call_scope(isolate, getter_address);
1295 result = fun(v8::Utils::ToLocal(args.at<String>(4)), info); 1294 result = fun(v8::Utils::ToLocal(args.at<String>(4)), info);
1296 } 1295 }
1297 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1296 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1298 if (result.IsEmpty()) return HEAP->undefined_value(); 1297 if (result.IsEmpty()) return HEAP->undefined_value();
1299 return *v8::Utils::OpenHandle(*result); 1298 return *v8::Utils::OpenHandle(*result);
1300 } 1299 }
1301 1300
1302 1301
1303 MaybeObject* StoreCallbackProperty(RUNTIME_CALLING_CONVENTION) { 1302 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) {
1304 RUNTIME_GET_ISOLATE;
1305 JSObject* recv = JSObject::cast(args[0]); 1303 JSObject* recv = JSObject::cast(args[0]);
1306 AccessorInfo* callback = AccessorInfo::cast(args[1]); 1304 AccessorInfo* callback = AccessorInfo::cast(args[1]);
1307 Address setter_address = v8::ToCData<Address>(callback->setter()); 1305 Address setter_address = v8::ToCData<Address>(callback->setter());
1308 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); 1306 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address);
1309 ASSERT(fun != NULL); 1307 ASSERT(fun != NULL);
1310 Handle<String> name = args.at<String>(2); 1308 Handle<String> name = args.at<String>(2);
1311 Handle<Object> value = args.at<Object>(3); 1309 Handle<Object> value = args.at<Object>(3);
1312 HandleScope scope(isolate); 1310 HandleScope scope(isolate);
1313 LOG(isolate, ApiNamedPropertyAccess("store", recv, *name)); 1311 LOG(isolate, ApiNamedPropertyAccess("store", recv, *name));
1314 CustomArguments custom_args(isolate, callback->data(), recv, recv); 1312 CustomArguments custom_args(isolate, callback->data(), recv, recv);
(...skipping 12 matching lines...) Expand all
1327 static const int kAccessorInfoOffsetInInterceptorArgs = 2; 1325 static const int kAccessorInfoOffsetInInterceptorArgs = 2;
1328 1326
1329 1327
1330 /** 1328 /**
1331 * Attempts to load a property with an interceptor (which must be present), 1329 * Attempts to load a property with an interceptor (which must be present),
1332 * but doesn't search the prototype chain. 1330 * but doesn't search the prototype chain.
1333 * 1331 *
1334 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't 1332 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't
1335 * provide any value for the given name. 1333 * provide any value for the given name.
1336 */ 1334 */
1337 MaybeObject* LoadPropertyWithInterceptorOnly(RUNTIME_CALLING_CONVENTION) { 1335 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorOnly) {
1338 RUNTIME_GET_ISOLATE;
1339 Handle<String> name_handle = args.at<String>(0); 1336 Handle<String> name_handle = args.at<String>(0);
1340 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(1); 1337 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(1);
1341 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); 1338 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2);
1342 ASSERT(args[2]->IsJSObject()); // Receiver. 1339 ASSERT(args[2]->IsJSObject()); // Receiver.
1343 ASSERT(args[3]->IsJSObject()); // Holder. 1340 ASSERT(args[3]->IsJSObject()); // Holder.
1344 ASSERT(args.length() == 5); // Last arg is data object. 1341 ASSERT(args.length() == 5); // Last arg is data object.
1345 1342
1346 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); 1343 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
1347 v8::NamedPropertyGetter getter = 1344 v8::NamedPropertyGetter getter =
1348 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); 1345 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 attrs); 1424 attrs);
1428 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1425 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1429 return result; 1426 return result;
1430 } 1427 }
1431 1428
1432 1429
1433 /** 1430 /**
1434 * Loads a property with an interceptor performing post interceptor 1431 * Loads a property with an interceptor performing post interceptor
1435 * lookup if interceptor failed. 1432 * lookup if interceptor failed.
1436 */ 1433 */
1437 MaybeObject* LoadPropertyWithInterceptorForLoad(RUNTIME_CALLING_CONVENTION) { 1434 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad) {
1438 RUNTIME_GET_ISOLATE;
1439 PropertyAttributes attr = NONE; 1435 PropertyAttributes attr = NONE;
1440 Object* result; 1436 Object* result;
1441 { MaybeObject* maybe_result = LoadWithInterceptor(&args, &attr); 1437 { MaybeObject* maybe_result = LoadWithInterceptor(&args, &attr);
1442 if (!maybe_result->ToObject(&result)) return maybe_result; 1438 if (!maybe_result->ToObject(&result)) return maybe_result;
1443 } 1439 }
1444 1440
1445 // If the property is present, return it. 1441 // If the property is present, return it.
1446 if (attr != ABSENT) return result; 1442 if (attr != ABSENT) return result;
1447 return ThrowReferenceError(String::cast(args[0])); 1443 return ThrowReferenceError(String::cast(args[0]));
1448 } 1444 }
1449 1445
1450 1446
1451 MaybeObject* LoadPropertyWithInterceptorForCall(RUNTIME_CALLING_CONVENTION) { 1447 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) {
1452 RUNTIME_GET_ISOLATE;
1453 PropertyAttributes attr; 1448 PropertyAttributes attr;
1454 MaybeObject* result = LoadWithInterceptor(&args, &attr); 1449 MaybeObject* result = LoadWithInterceptor(&args, &attr);
1455 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1450 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1456 // This is call IC. In this case, we simply return the undefined result which 1451 // This is call IC. In this case, we simply return the undefined result which
1457 // will lead to an exception when trying to invoke the result as a 1452 // will lead to an exception when trying to invoke the result as a
1458 // function. 1453 // function.
1459 return result; 1454 return result;
1460 } 1455 }
1461 1456
1462 1457
1463 MaybeObject* StoreInterceptorProperty(RUNTIME_CALLING_CONVENTION) { 1458 RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) {
1464 RUNTIME_GET_ISOLATE;
1465 ASSERT(args.length() == 4); 1459 ASSERT(args.length() == 4);
1466 JSObject* recv = JSObject::cast(args[0]); 1460 JSObject* recv = JSObject::cast(args[0]);
1467 String* name = String::cast(args[1]); 1461 String* name = String::cast(args[1]);
1468 Object* value = args[2]; 1462 Object* value = args[2];
1469 StrictModeFlag strict_mode = 1463 StrictModeFlag strict_mode =
1470 static_cast<StrictModeFlag>(Smi::cast(args[3])->value()); 1464 static_cast<StrictModeFlag>(Smi::cast(args[3])->value());
1471 ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode); 1465 ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode);
1472 ASSERT(recv->HasNamedInterceptor()); 1466 ASSERT(recv->HasNamedInterceptor());
1473 PropertyAttributes attr = NONE; 1467 PropertyAttributes attr = NONE;
1474 MaybeObject* result = recv->SetPropertyWithInterceptor( 1468 MaybeObject* result = recv->SetPropertyWithInterceptor(
1475 name, value, attr, strict_mode); 1469 name, value, attr, strict_mode);
1476 return result; 1470 return result;
1477 } 1471 }
1478 1472
1479 1473
1480 MaybeObject* KeyedLoadPropertyWithInterceptor(RUNTIME_CALLING_CONVENTION) { 1474 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor) {
1481 RUNTIME_GET_ISOLATE;
1482 JSObject* receiver = JSObject::cast(args[0]); 1475 JSObject* receiver = JSObject::cast(args[0]);
1483 ASSERT(Smi::cast(args[1])->value() >= 0); 1476 ASSERT(Smi::cast(args[1])->value() >= 0);
1484 uint32_t index = Smi::cast(args[1])->value(); 1477 uint32_t index = Smi::cast(args[1])->value();
1485 return receiver->GetElementWithInterceptor(receiver, index); 1478 return receiver->GetElementWithInterceptor(receiver, index);
1486 } 1479 }
1487 1480
1488 1481
1489 MaybeObject* StubCompiler::CompileCallInitialize(Code::Flags flags) { 1482 MaybeObject* StubCompiler::CompileCallInitialize(Code::Flags flags) {
1490 HandleScope scope(isolate()); 1483 HandleScope scope(isolate());
1491 int argc = Code::ExtractArgumentsCountFromFlags(flags); 1484 int argc = Code::ExtractArgumentsCountFromFlags(flags);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 } 1930 }
1938 Code* code = Code::cast(result); 1931 Code* code = Code::cast(result);
1939 USE(code); 1932 USE(code);
1940 PROFILE(isolate(), 1933 PROFILE(isolate(),
1941 CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); 1934 CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub"));
1942 return result; 1935 return result;
1943 } 1936 }
1944 1937
1945 1938
1946 } } // namespace v8::internal 1939 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698