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

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

Issue 338017: Remove --check-stack flag from V8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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/ia32/regexp-macro-assembler-ia32.cc ('k') | src/x64/codegen-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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // rbp[2]: function arguments 311 // rbp[2]: function arguments
312 // rbp[3]: receiver 312 // rbp[3]: receiver
313 // rbp[4]: function 313 // rbp[4]: function
314 static const int kArgumentsOffset = 2 * kPointerSize; 314 static const int kArgumentsOffset = 2 * kPointerSize;
315 static const int kReceiverOffset = 3 * kPointerSize; 315 static const int kReceiverOffset = 3 * kPointerSize;
316 static const int kFunctionOffset = 4 * kPointerSize; 316 static const int kFunctionOffset = 4 * kPointerSize;
317 __ push(Operand(rbp, kFunctionOffset)); 317 __ push(Operand(rbp, kFunctionOffset));
318 __ push(Operand(rbp, kArgumentsOffset)); 318 __ push(Operand(rbp, kArgumentsOffset));
319 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); 319 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION);
320 320
321 if (FLAG_check_stack) { 321 // Check the stack for overflow or a break request.
322 // We need to catch preemptions right here, otherwise an unlucky preemption 322 // We need to catch preemptions right here, otherwise an unlucky preemption
323 // could show up as a failed apply. 323 // could show up as a failed apply.
324 Label retry_preemption; 324 Label retry_preemption;
325 Label no_preemption; 325 Label no_preemption;
326 __ bind(&retry_preemption); 326 __ bind(&retry_preemption);
327 ExternalReference stack_guard_limit = 327 ExternalReference stack_guard_limit =
328 ExternalReference::address_of_stack_guard_limit(); 328 ExternalReference::address_of_stack_guard_limit();
329 __ movq(kScratchRegister, stack_guard_limit); 329 __ movq(kScratchRegister, stack_guard_limit);
330 __ movq(rcx, rsp); 330 __ movq(rcx, rsp);
331 __ subq(rcx, Operand(kScratchRegister, 0)); 331 __ subq(rcx, Operand(kScratchRegister, 0));
332 // rcx contains the difference between the stack limit and the stack top. 332 // rcx contains the difference between the stack limit and the stack top.
333 // We use it below to check that there is enough room for the arguments. 333 // We use it below to check that there is enough room for the arguments.
334 __ j(above, &no_preemption); 334 __ j(above, &no_preemption);
335 335
336 // Preemption! 336 // Preemption!
337 // Because runtime functions always remove the receiver from the stack, we 337 // Because runtime functions always remove the receiver from the stack, we
338 // have to fake one to avoid underflowing the stack. 338 // have to fake one to avoid underflowing the stack.
339 __ push(rax); 339 __ push(rax);
340 __ Push(Smi::FromInt(0)); 340 __ Push(Smi::FromInt(0));
341 341
342 // Do call to runtime routine. 342 // Do call to runtime routine.
343 __ CallRuntime(Runtime::kStackGuard, 1); 343 __ CallRuntime(Runtime::kStackGuard, 1);
344 __ pop(rax); 344 __ pop(rax);
345 __ jmp(&retry_preemption); 345 __ jmp(&retry_preemption);
346 346
347 __ bind(&no_preemption); 347 __ bind(&no_preemption);
348 348
349 Label okay; 349 Label okay;
350 // Make rdx the space we need for the array when it is unrolled onto the 350 // Make rdx the space we need for the array when it is unrolled onto the
351 // stack. 351 // stack.
352 __ PositiveSmiTimesPowerOfTwoToInteger64(rdx, rax, kPointerSizeLog2); 352 __ PositiveSmiTimesPowerOfTwoToInteger64(rdx, rax, kPointerSizeLog2);
353 __ cmpq(rcx, rdx); 353 __ cmpq(rcx, rdx);
354 __ j(greater, &okay); 354 __ j(greater, &okay);
355 355
356 // Too bad: Out of stack space. 356 // Too bad: Out of stack space.
357 __ push(Operand(rbp, kFunctionOffset)); 357 __ push(Operand(rbp, kFunctionOffset));
358 __ push(rax); 358 __ push(rax);
359 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); 359 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
360 __ bind(&okay); 360 __ bind(&okay);
361 } 361 // End of stack check.
362 362
363 // Push current index and limit. 363 // Push current index and limit.
364 const int kLimitOffset = 364 const int kLimitOffset =
365 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize; 365 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize;
366 const int kIndexOffset = kLimitOffset - 1 * kPointerSize; 366 const int kIndexOffset = kLimitOffset - 1 * kPointerSize;
367 __ push(rax); // limit 367 __ push(rax); // limit
368 __ push(Immediate(0)); // index 368 __ push(Immediate(0)); // index
369 369
370 // Change context eagerly to get the right global object if 370 // Change context eagerly to get the right global object if
371 // necessary. 371 // necessary.
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 1261 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
1262 Generate_JSEntryTrampolineHelper(masm, false); 1262 Generate_JSEntryTrampolineHelper(masm, false);
1263 } 1263 }
1264 1264
1265 1265
1266 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 1266 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
1267 Generate_JSEntryTrampolineHelper(masm, true); 1267 Generate_JSEntryTrampolineHelper(masm, true);
1268 } 1268 }
1269 1269
1270 } } // namespace v8::internal 1270 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/regexp-macro-assembler-ia32.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698