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

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

Issue 246643014: CodeStubs contain their corresponding Isolate* now. (part 1) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback. Rebased. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/ic.cc ('k') | src/type-info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 } 1181 }
1182 1182
1183 1183
1184 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( 1184 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement(
1185 Handle<Map> receiver_map) { 1185 Handle<Map> receiver_map) {
1186 ElementsKind elements_kind = receiver_map->elements_kind(); 1186 ElementsKind elements_kind = receiver_map->elements_kind();
1187 if (receiver_map->has_fast_elements() || 1187 if (receiver_map->has_fast_elements() ||
1188 receiver_map->has_external_array_elements() || 1188 receiver_map->has_external_array_elements() ||
1189 receiver_map->has_fixed_typed_array_elements()) { 1189 receiver_map->has_fixed_typed_array_elements()) {
1190 Handle<Code> stub = KeyedLoadFastElementStub( 1190 Handle<Code> stub = KeyedLoadFastElementStub(
1191 isolate(),
1191 receiver_map->instance_type() == JS_ARRAY_TYPE, 1192 receiver_map->instance_type() == JS_ARRAY_TYPE,
1192 elements_kind).GetCode(isolate()); 1193 elements_kind).GetCode(isolate());
1193 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); 1194 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1194 } else { 1195 } else {
1195 Handle<Code> stub = FLAG_compiled_keyed_dictionary_loads 1196 Handle<Code> stub = FLAG_compiled_keyed_dictionary_loads
1196 ? KeyedLoadDictionaryElementStub().GetCode(isolate()) 1197 ? KeyedLoadDictionaryElementStub(isolate()).GetCode(isolate())
1197 : KeyedLoadDictionaryElementPlatformStub().GetCode(isolate()); 1198 : KeyedLoadDictionaryElementPlatformStub(isolate()).GetCode(isolate());
1198 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); 1199 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1199 } 1200 }
1200 1201
1201 TailCallBuiltin(masm(), Builtins::kKeyedLoadIC_Miss); 1202 TailCallBuiltin(masm(), Builtins::kKeyedLoadIC_Miss);
1202 1203
1203 // Return the generated code. 1204 // Return the generated code.
1204 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); 1205 return GetICCode(kind(), Code::NORMAL, factory()->empty_string());
1205 } 1206 }
1206 1207
1207 1208
1208 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement( 1209 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement(
1209 Handle<Map> receiver_map) { 1210 Handle<Map> receiver_map) {
1210 ElementsKind elements_kind = receiver_map->elements_kind(); 1211 ElementsKind elements_kind = receiver_map->elements_kind();
1211 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; 1212 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE;
1212 Handle<Code> stub; 1213 Handle<Code> stub;
1213 if (receiver_map->has_fast_elements() || 1214 if (receiver_map->has_fast_elements() ||
1214 receiver_map->has_external_array_elements() || 1215 receiver_map->has_external_array_elements() ||
1215 receiver_map->has_fixed_typed_array_elements()) { 1216 receiver_map->has_fixed_typed_array_elements()) {
1216 stub = KeyedStoreFastElementStub( 1217 stub = KeyedStoreFastElementStub(
1218 isolate(),
1217 is_jsarray, 1219 is_jsarray,
1218 elements_kind, 1220 elements_kind,
1219 store_mode()).GetCode(isolate()); 1221 store_mode()).GetCode(isolate());
1220 } else { 1222 } else {
1221 stub = KeyedStoreElementStub(is_jsarray, 1223 stub = KeyedStoreElementStub(isolate(),
1224 is_jsarray,
1222 elements_kind, 1225 elements_kind,
1223 store_mode()).GetCode(isolate()); 1226 store_mode()).GetCode(isolate());
1224 } 1227 }
1225 1228
1226 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); 1229 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1227 1230
1228 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); 1231 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss);
1229 1232
1230 // Return the generated code. 1233 // Return the generated code.
1231 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); 1234 return GetICCode(kind(), Code::NORMAL, factory()->empty_string());
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { 1310 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) {
1308 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); 1311 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow();
1309 } else { 1312 } else {
1310 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1313 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1311 ElementsKind elements_kind = receiver_map->elements_kind(); 1314 ElementsKind elements_kind = receiver_map->elements_kind();
1312 1315
1313 if (IsFastElementsKind(elements_kind) || 1316 if (IsFastElementsKind(elements_kind) ||
1314 IsExternalArrayElementsKind(elements_kind) || 1317 IsExternalArrayElementsKind(elements_kind) ||
1315 IsFixedTypedArrayElementsKind(elements_kind)) { 1318 IsFixedTypedArrayElementsKind(elements_kind)) {
1316 cached_stub = 1319 cached_stub =
1317 KeyedLoadFastElementStub(is_js_array, 1320 KeyedLoadFastElementStub(isolate(),
1321 is_js_array,
1318 elements_kind).GetCode(isolate()); 1322 elements_kind).GetCode(isolate());
1319 } else if (elements_kind == SLOPPY_ARGUMENTS_ELEMENTS) { 1323 } else if (elements_kind == SLOPPY_ARGUMENTS_ELEMENTS) {
1320 cached_stub = isolate()->builtins()->KeyedLoadIC_SloppyArguments(); 1324 cached_stub = isolate()->builtins()->KeyedLoadIC_SloppyArguments();
1321 } else { 1325 } else {
1322 ASSERT(elements_kind == DICTIONARY_ELEMENTS); 1326 ASSERT(elements_kind == DICTIONARY_ELEMENTS);
1323 cached_stub = KeyedLoadDictionaryElementStub().GetCode(isolate()); 1327 cached_stub =
1328 KeyedLoadDictionaryElementStub(isolate()).GetCode(isolate());
1324 } 1329 }
1325 } 1330 }
1326 1331
1327 handlers->Add(cached_stub); 1332 handlers->Add(cached_stub);
1328 } 1333 }
1329 } 1334 }
1330 1335
1331 1336
1332 Handle<Code> KeyedStoreStubCompiler::CompileStoreElementPolymorphic( 1337 Handle<Code> KeyedStoreStubCompiler::CompileStoreElementPolymorphic(
1333 MapHandleList* receiver_maps) { 1338 MapHandleList* receiver_maps) {
1334 // Collect MONOMORPHIC stubs for all |receiver_maps|. 1339 // Collect MONOMORPHIC stubs for all |receiver_maps|.
1335 CodeHandleList handlers(receiver_maps->length()); 1340 CodeHandleList handlers(receiver_maps->length());
1336 MapHandleList transitioned_maps(receiver_maps->length()); 1341 MapHandleList transitioned_maps(receiver_maps->length());
1337 for (int i = 0; i < receiver_maps->length(); ++i) { 1342 for (int i = 0; i < receiver_maps->length(); ++i) {
1338 Handle<Map> receiver_map(receiver_maps->at(i)); 1343 Handle<Map> receiver_map(receiver_maps->at(i));
1339 Handle<Code> cached_stub; 1344 Handle<Code> cached_stub;
1340 Handle<Map> transitioned_map = 1345 Handle<Map> transitioned_map =
1341 receiver_map->FindTransitionedMap(receiver_maps); 1346 receiver_map->FindTransitionedMap(receiver_maps);
1342 1347
1343 // TODO(mvstanton): The code below is doing pessimistic elements 1348 // TODO(mvstanton): The code below is doing pessimistic elements
1344 // transitions. I would like to stop doing that and rely on Allocation Site 1349 // transitions. I would like to stop doing that and rely on Allocation Site
1345 // Tracking to do a better job of ensuring the data types are what they need 1350 // Tracking to do a better job of ensuring the data types are what they need
1346 // to be. Not all the elements are in place yet, pessimistic elements 1351 // to be. Not all the elements are in place yet, pessimistic elements
1347 // transitions are still important for performance. 1352 // transitions are still important for performance.
1348 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1353 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1349 ElementsKind elements_kind = receiver_map->elements_kind(); 1354 ElementsKind elements_kind = receiver_map->elements_kind();
1350 if (!transitioned_map.is_null()) { 1355 if (!transitioned_map.is_null()) {
1351 cached_stub = ElementsTransitionAndStoreStub( 1356 cached_stub = ElementsTransitionAndStoreStub(
1357 isolate(),
1352 elements_kind, 1358 elements_kind,
1353 transitioned_map->elements_kind(), 1359 transitioned_map->elements_kind(),
1354 is_js_array, 1360 is_js_array,
1355 store_mode()).GetCode(isolate()); 1361 store_mode()).GetCode(isolate());
1356 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { 1362 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) {
1357 cached_stub = isolate()->builtins()->KeyedStoreIC_Slow(); 1363 cached_stub = isolate()->builtins()->KeyedStoreIC_Slow();
1358 } else { 1364 } else {
1359 if (receiver_map->has_fast_elements() || 1365 if (receiver_map->has_fast_elements() ||
1360 receiver_map->has_external_array_elements() || 1366 receiver_map->has_external_array_elements() ||
1361 receiver_map->has_fixed_typed_array_elements()) { 1367 receiver_map->has_fixed_typed_array_elements()) {
1362 cached_stub = KeyedStoreFastElementStub( 1368 cached_stub = KeyedStoreFastElementStub(
1369 isolate(),
1363 is_js_array, 1370 is_js_array,
1364 elements_kind, 1371 elements_kind,
1365 store_mode()).GetCode(isolate()); 1372 store_mode()).GetCode(isolate());
1366 } else { 1373 } else {
1367 cached_stub = KeyedStoreElementStub( 1374 cached_stub = KeyedStoreElementStub(
1375 isolate(),
1368 is_js_array, 1376 is_js_array,
1369 elements_kind, 1377 elements_kind,
1370 store_mode()).GetCode(isolate()); 1378 store_mode()).GetCode(isolate());
1371 } 1379 }
1372 } 1380 }
1373 ASSERT(!cached_stub.is_null()); 1381 ASSERT(!cached_stub.is_null());
1374 handlers.Add(cached_stub); 1382 handlers.Add(cached_stub);
1375 transitioned_maps.Add(transitioned_map); 1383 transitioned_maps.Add(transitioned_map);
1376 } 1384 }
1377 Handle<Code> code = 1385 Handle<Code> code =
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 Handle<FunctionTemplateInfo>( 1507 Handle<FunctionTemplateInfo>(
1500 FunctionTemplateInfo::cast(signature->receiver())); 1508 FunctionTemplateInfo::cast(signature->receiver()));
1501 } 1509 }
1502 } 1510 }
1503 1511
1504 is_simple_api_call_ = true; 1512 is_simple_api_call_ = true;
1505 } 1513 }
1506 1514
1507 1515
1508 } } // namespace v8::internal 1516 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698