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

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

Issue 660004: Fix miss in smi check when doing fast api call. (Closed)
Patch Set: Created 10 years, 10 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 | test/cctest/test-api.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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 JSFunction* function, 1216 JSFunction* function,
1217 String* name, 1217 String* name,
1218 CheckType check) { 1218 CheckType check) {
1219 // ----------- S t a t e ------------- 1219 // ----------- S t a t e -------------
1220 // -- ecx : name 1220 // -- ecx : name
1221 // -- esp[0] : return address 1221 // -- esp[0] : return address
1222 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1222 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1223 // -- ... 1223 // -- ...
1224 // -- esp[(argc + 1) * 4] : receiver 1224 // -- esp[(argc + 1) * 4] : receiver
1225 // ----------------------------------- 1225 // -----------------------------------
1226 Label miss; 1226 Label miss_in_smi_check;
1227 1227
1228 // Get the receiver from the stack. 1228 // Get the receiver from the stack.
1229 const int argc = arguments().immediate(); 1229 const int argc = arguments().immediate();
1230 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); 1230 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
1231 1231
1232 // Check that the receiver isn't a smi. 1232 // Check that the receiver isn't a smi.
1233 if (check != NUMBER_CHECK) { 1233 if (check != NUMBER_CHECK) {
1234 __ test(edx, Immediate(kSmiTagMask)); 1234 __ test(edx, Immediate(kSmiTagMask));
1235 __ j(zero, &miss, not_taken); 1235 __ j(zero, &miss_in_smi_check, not_taken);
1236 } 1236 }
1237 1237
1238 // Make sure that it's okay not to patch the on stack receiver 1238 // Make sure that it's okay not to patch the on stack receiver
1239 // unless we're doing a receiver map check. 1239 // unless we're doing a receiver map check.
1240 ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK); 1240 ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK);
1241 1241
1242 CallOptimization optimization(function); 1242 CallOptimization optimization(function);
1243 int depth = kInvalidProtoDepth; 1243 int depth = kInvalidProtoDepth;
1244 Label miss;
1244 1245
1245 switch (check) { 1246 switch (check) {
1246 case RECEIVER_MAP_CHECK: 1247 case RECEIVER_MAP_CHECK:
1247 __ IncrementCounter(&Counters::call_const, 1); 1248 __ IncrementCounter(&Counters::call_const, 1);
1248 1249
1249 if (optimization.is_simple_api_call() && !object->IsGlobalObject()) { 1250 if (optimization.is_simple_api_call() && !object->IsGlobalObject()) {
1250 depth = optimization.GetPrototypeDepthOfExpectedType( 1251 depth = optimization.GetPrototypeDepthOfExpectedType(
1251 JSObject::cast(object), holder); 1252 JSObject::cast(object), holder);
1252 } 1253 }
1253 1254
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 GenerateFastApiCall(masm(), optimization, argc); 1353 GenerateFastApiCall(masm(), optimization, argc);
1353 } else { 1354 } else {
1354 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1355 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1355 } 1356 }
1356 1357
1357 // Handle call cache miss. 1358 // Handle call cache miss.
1358 __ bind(&miss); 1359 __ bind(&miss);
1359 if (depth != kInvalidProtoDepth) { 1360 if (depth != kInvalidProtoDepth) {
1360 FreeSpaceForFastApiCall(masm(), eax); 1361 FreeSpaceForFastApiCall(masm(), eax);
1361 } 1362 }
1363 __ bind(&miss_in_smi_check);
1362 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 1364 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
1363 __ jmp(ic, RelocInfo::CODE_TARGET); 1365 __ jmp(ic, RelocInfo::CODE_TARGET);
1364 1366
1365 // Return the generated code. 1367 // Return the generated code.
1366 String* function_name = NULL; 1368 String* function_name = NULL;
1367 if (function->shared()->name()->IsString()) { 1369 if (function->shared()->name()->IsString()) {
1368 function_name = String::cast(function->shared()->name()); 1370 function_name = String::cast(function->shared()->name());
1369 } 1371 }
1370 return GetCode(CONSTANT_FUNCTION, function_name); 1372 return GetCode(CONSTANT_FUNCTION, function_name);
1371 } 1373 }
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); 2204 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET);
2203 2205
2204 // Return the generated code. 2206 // Return the generated code.
2205 return GetCode(); 2207 return GetCode();
2206 } 2208 }
2207 2209
2208 2210
2209 #undef __ 2211 #undef __
2210 2212
2211 } } // namespace v8::internal 2213 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698