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

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

Issue 2239009: Direct load of global function prototype. (Closed)
Patch Set: Ports Created 10 years, 6 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 | « no previous file | src/ia32/stub-cache-ia32.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 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Load the function from the global context. 145 // Load the function from the global context.
146 __ ldr(prototype, MemOperand(prototype, Context::SlotOffset(index))); 146 __ ldr(prototype, MemOperand(prototype, Context::SlotOffset(index)));
147 // Load the initial map. The global functions all have initial maps. 147 // Load the initial map. The global functions all have initial maps.
148 __ ldr(prototype, 148 __ ldr(prototype,
149 FieldMemOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset)); 149 FieldMemOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset));
150 // Load the prototype from the initial map. 150 // Load the prototype from the initial map.
151 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); 151 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset));
152 } 152 }
153 153
154 154
155 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
156 MacroAssembler* masm, int index, Register prototype) {
157 // Get the global function with the given index.
158 JSFunction* function = JSFunction::cast(Top::global_context()->get(index));
159 // Load its initial map. The global functions all have initial maps.
160 __ Move(prototype, Handle<Map>(function->initial_map()));
161 // Load the prototype from the initial map.
162 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset));
163 }
164
165
155 // Load a fast property out of a holder object (src). In-object properties 166 // Load a fast property out of a holder object (src). In-object properties
156 // are loaded directly otherwise the property is loaded from the properties 167 // are loaded directly otherwise the property is loaded from the properties
157 // fixed array. 168 // fixed array.
158 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, 169 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
159 Register dst, Register src, 170 Register dst, Register src,
160 JSObject* holder, int index) { 171 JSObject* holder, int index) {
161 // Adjust for the number of properties stored in the holder. 172 // Adjust for the number of properties stored in the holder.
162 index -= holder->map()->inobject_properties(); 173 index -= holder->map()->inobject_properties();
163 if (index < 0) { 174 if (index < 0) {
164 // Get the property straight out of the holder. 175 // Get the property straight out of the holder.
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1242
1232 case STRING_CHECK: 1243 case STRING_CHECK:
1233 if (!function->IsBuiltin()) { 1244 if (!function->IsBuiltin()) {
1234 // Calling non-builtins with a value as receiver requires boxing. 1245 // Calling non-builtins with a value as receiver requires boxing.
1235 __ jmp(&miss); 1246 __ jmp(&miss);
1236 } else { 1247 } else {
1237 // Check that the object is a two-byte string or a symbol. 1248 // Check that the object is a two-byte string or a symbol.
1238 __ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE); 1249 __ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE);
1239 __ b(hs, &miss); 1250 __ b(hs, &miss);
1240 // Check that the maps starting from the prototype haven't changed. 1251 // Check that the maps starting from the prototype haven't changed.
1241 GenerateLoadGlobalFunctionPrototype(masm(), 1252 GenerateDirectLoadGlobalFunctionPrototype(
1242 Context::STRING_FUNCTION_INDEX, 1253 masm(), Context::STRING_FUNCTION_INDEX, r0);
1243 r0);
1244 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, 1254 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3,
1245 r1, name, &miss); 1255 r1, name, &miss);
1246 } 1256 }
1247 break; 1257 break;
1248 1258
1249 case NUMBER_CHECK: { 1259 case NUMBER_CHECK: {
1250 if (!function->IsBuiltin()) { 1260 if (!function->IsBuiltin()) {
1251 // Calling non-builtins with a value as receiver requires boxing. 1261 // Calling non-builtins with a value as receiver requires boxing.
1252 __ jmp(&miss); 1262 __ jmp(&miss);
1253 } else { 1263 } else {
1254 Label fast; 1264 Label fast;
1255 // Check that the object is a smi or a heap number. 1265 // Check that the object is a smi or a heap number.
1256 __ tst(r1, Operand(kSmiTagMask)); 1266 __ tst(r1, Operand(kSmiTagMask));
1257 __ b(eq, &fast); 1267 __ b(eq, &fast);
1258 __ CompareObjectType(r1, r0, r0, HEAP_NUMBER_TYPE); 1268 __ CompareObjectType(r1, r0, r0, HEAP_NUMBER_TYPE);
1259 __ b(ne, &miss); 1269 __ b(ne, &miss);
1260 __ bind(&fast); 1270 __ bind(&fast);
1261 // Check that the maps starting from the prototype haven't changed. 1271 // Check that the maps starting from the prototype haven't changed.
1262 GenerateLoadGlobalFunctionPrototype(masm(), 1272 GenerateDirectLoadGlobalFunctionPrototype(
1263 Context::NUMBER_FUNCTION_INDEX, 1273 masm(), Context::NUMBER_FUNCTION_INDEX, r0);
1264 r0);
1265 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, 1274 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3,
1266 r1, name, &miss); 1275 r1, name, &miss);
1267 } 1276 }
1268 break; 1277 break;
1269 } 1278 }
1270 1279
1271 case BOOLEAN_CHECK: { 1280 case BOOLEAN_CHECK: {
1272 if (!function->IsBuiltin()) { 1281 if (!function->IsBuiltin()) {
1273 // Calling non-builtins with a value as receiver requires boxing. 1282 // Calling non-builtins with a value as receiver requires boxing.
1274 __ jmp(&miss); 1283 __ jmp(&miss);
1275 } else { 1284 } else {
1276 Label fast; 1285 Label fast;
1277 // Check that the object is a boolean. 1286 // Check that the object is a boolean.
1278 __ LoadRoot(ip, Heap::kTrueValueRootIndex); 1287 __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1279 __ cmp(r1, ip); 1288 __ cmp(r1, ip);
1280 __ b(eq, &fast); 1289 __ b(eq, &fast);
1281 __ LoadRoot(ip, Heap::kFalseValueRootIndex); 1290 __ LoadRoot(ip, Heap::kFalseValueRootIndex);
1282 __ cmp(r1, ip); 1291 __ cmp(r1, ip);
1283 __ b(ne, &miss); 1292 __ b(ne, &miss);
1284 __ bind(&fast); 1293 __ bind(&fast);
1285 // Check that the maps starting from the prototype haven't changed. 1294 // Check that the maps starting from the prototype haven't changed.
1286 GenerateLoadGlobalFunctionPrototype(masm(), 1295 GenerateDirectLoadGlobalFunctionPrototype(
1287 Context::BOOLEAN_FUNCTION_INDEX, 1296 masm(), Context::BOOLEAN_FUNCTION_INDEX, r0);
1288 r0);
1289 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, 1297 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3,
1290 r1, name, &miss); 1298 r1, name, &miss);
1291 } 1299 }
1292 break; 1300 break;
1293 } 1301 }
1294 1302
1295 default: 1303 default:
1296 UNREACHABLE(); 1304 UNREACHABLE();
1297 } 1305 }
1298 1306
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 // Return the generated code. 2130 // Return the generated code.
2123 return GetCode(); 2131 return GetCode();
2124 } 2132 }
2125 2133
2126 2134
2127 #undef __ 2135 #undef __
2128 2136
2129 } } // namespace v8::internal 2137 } } // namespace v8::internal
2130 2138
2131 #endif // V8_TARGET_ARCH_ARM 2139 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698