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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 9016041: Ensure that InternalArrays remain InternalArrays regardless of how they are constructed. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix whitespace Created 8 years, 12 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/contexts.h ('k') | src/x64/builtins-x64.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 // Restore argc and constructor before running the generic code. 1301 // Restore argc and constructor before running the generic code.
1302 __ bind(&prepare_generic_code_call); 1302 __ bind(&prepare_generic_code_call);
1303 __ pop(eax); 1303 __ pop(eax);
1304 if (construct_call) { 1304 if (construct_call) {
1305 __ pop(edi); 1305 __ pop(edi);
1306 } 1306 }
1307 __ jmp(call_generic_code); 1307 __ jmp(call_generic_code);
1308 } 1308 }
1309 1309
1310 1310
1311 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
1312 // ----------- S t a t e -------------
1313 // -- eax : argc
1314 // -- esp[0] : return address
1315 // -- esp[4] : last argument
1316 // -----------------------------------
1317 Label generic_array_code;
1318
1319 // Get the InternalArray function.
1320 __ LoadGlobalFunction(Context::INTERNAL_ARRAY_FUNCTION_INDEX, edi);
1321
1322 if (FLAG_debug_code) {
1323 // Initial map for the builtin InternalArray function shoud be a map.
1324 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
1325 // Will both indicate a NULL and a Smi.
1326 __ test(ebx, Immediate(kSmiTagMask));
1327 __ Assert(not_zero, "Unexpected initial map for InternalArray function");
1328 __ CmpObjectType(ebx, MAP_TYPE, ecx);
1329 __ Assert(equal, "Unexpected initial map for InternalArray function");
1330 }
1331
1332 // Run the native code for the InternalArray function called as a normal
1333 // function.
1334 ArrayNativeCode(masm, false, &generic_array_code);
1335
1336 // Jump to the generic array code in case the specialized code cannot handle
1337 // the construction.
1338 __ bind(&generic_array_code);
1339 Handle<Code> array_code =
1340 masm->isolate()->builtins()->ArrayCodeGeneric();
1341 __ jmp(array_code, RelocInfo::CODE_TARGET);
1342 }
1343
1344
1311 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { 1345 void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
1312 // ----------- S t a t e ------------- 1346 // ----------- S t a t e -------------
1313 // -- eax : argc 1347 // -- eax : argc
1314 // -- esp[0] : return address 1348 // -- esp[0] : return address
1315 // -- esp[4] : last argument 1349 // -- esp[4] : last argument
1316 // ----------------------------------- 1350 // -----------------------------------
1317 Label generic_array_code; 1351 Label generic_array_code;
1318 1352
1319 // Get the Array function. 1353 // Get the Array function.
1320 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, edi); 1354 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, edi);
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1723 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1690 generator.Generate(); 1724 generator.Generate();
1691 } 1725 }
1692 1726
1693 1727
1694 #undef __ 1728 #undef __
1695 } 1729 }
1696 } // namespace v8::internal 1730 } // namespace v8::internal
1697 1731
1698 #endif // V8_TARGET_ARCH_IA32 1732 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698