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

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

Issue 555164: Fix exit frame type in breakpoint stub (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 9055 matching lines...) Expand 10 before | Expand all | Expand 10 after
9066 // Slow-case: Non-function called. 9066 // Slow-case: Non-function called.
9067 __ bind(&slow); 9067 __ bind(&slow);
9068 __ Set(eax, Immediate(argc_)); 9068 __ Set(eax, Immediate(argc_));
9069 __ Set(ebx, Immediate(0)); 9069 __ Set(ebx, Immediate(0));
9070 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); 9070 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
9071 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); 9071 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline));
9072 __ jmp(adaptor, RelocInfo::CODE_TARGET); 9072 __ jmp(adaptor, RelocInfo::CODE_TARGET);
9073 } 9073 }
9074 9074
9075 9075
9076 int CEntryStub::MinorKey() {
9077 ASSERT(result_size_ <= 2);
9078 // Result returned in eax, or eax+edx if result_size_ is 2.
9079 return 0;
9080 }
9081
9082
9083 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { 9076 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
9084 // eax holds the exception. 9077 // eax holds the exception.
9085 9078
9086 // Adjust this code if not the case. 9079 // Adjust this code if not the case.
9087 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); 9080 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
9088 9081
9089 // Drop the sp to the top of the handler. 9082 // Drop the sp to the top of the handler.
9090 ExternalReference handler_address(Top::k_handler_address); 9083 ExternalReference handler_address(Top::k_handler_address);
9091 __ mov(esp, Operand::StaticVariable(handler_address)); 9084 __ mov(esp, Operand::StaticVariable(handler_address));
9092 9085
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
9182 __ TailCallRuntime(ExternalReference(Runtime::kPromoteScheduledException), 9175 __ TailCallRuntime(ExternalReference(Runtime::kPromoteScheduledException),
9183 0, 9176 0,
9184 1); 9177 1);
9185 } 9178 }
9186 9179
9187 9180
9188 void CEntryStub::GenerateCore(MacroAssembler* masm, 9181 void CEntryStub::GenerateCore(MacroAssembler* masm,
9189 Label* throw_normal_exception, 9182 Label* throw_normal_exception,
9190 Label* throw_termination_exception, 9183 Label* throw_termination_exception,
9191 Label* throw_out_of_memory_exception, 9184 Label* throw_out_of_memory_exception,
9192 ExitFrame::Mode mode,
9193 bool do_gc, 9185 bool do_gc,
9194 bool always_allocate_scope) { 9186 bool always_allocate_scope) {
9195 // eax: result parameter for PerformGC, if any 9187 // eax: result parameter for PerformGC, if any
9196 // ebx: pointer to C function (C callee-saved) 9188 // ebx: pointer to C function (C callee-saved)
9197 // ebp: frame pointer (restored after C call) 9189 // ebp: frame pointer (restored after C call)
9198 // esp: stack pointer (restored after C call) 9190 // esp: stack pointer (restored after C call)
9199 // edi: number of arguments including receiver (C callee-saved) 9191 // edi: number of arguments including receiver (C callee-saved)
9200 // esi: pointer to the first argument (C callee-saved) 9192 // esi: pointer to the first argument (C callee-saved)
9201 9193
9194 // Result returned in eax, or eax+edx if result_size_ is 2.
9195
9202 if (do_gc) { 9196 if (do_gc) {
9203 __ mov(Operand(esp, 0 * kPointerSize), eax); // Result. 9197 __ mov(Operand(esp, 0 * kPointerSize), eax); // Result.
9204 __ call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); 9198 __ call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY);
9205 } 9199 }
9206 9200
9207 ExternalReference scope_depth = 9201 ExternalReference scope_depth =
9208 ExternalReference::heap_always_allocate_scope_depth(); 9202 ExternalReference::heap_always_allocate_scope_depth();
9209 if (always_allocate_scope) { 9203 if (always_allocate_scope) {
9210 __ inc(Operand::StaticVariable(scope_depth)); 9204 __ inc(Operand::StaticVariable(scope_depth));
9211 } 9205 }
(...skipping 20 matching lines...) Expand all
9232 9226
9233 // Check for failure result. 9227 // Check for failure result.
9234 Label failure_returned; 9228 Label failure_returned;
9235 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); 9229 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0);
9236 __ lea(ecx, Operand(eax, 1)); 9230 __ lea(ecx, Operand(eax, 1));
9237 // Lower 2 bits of ecx are 0 iff eax has failure tag. 9231 // Lower 2 bits of ecx are 0 iff eax has failure tag.
9238 __ test(ecx, Immediate(kFailureTagMask)); 9232 __ test(ecx, Immediate(kFailureTagMask));
9239 __ j(zero, &failure_returned, not_taken); 9233 __ j(zero, &failure_returned, not_taken);
9240 9234
9241 // Exit the JavaScript to C++ exit frame. 9235 // Exit the JavaScript to C++ exit frame.
9242 __ LeaveExitFrame(mode); 9236 __ LeaveExitFrame(mode_);
9243 __ ret(0); 9237 __ ret(0);
9244 9238
9245 // Handling of failure. 9239 // Handling of failure.
9246 __ bind(&failure_returned); 9240 __ bind(&failure_returned);
9247 9241
9248 Label retry; 9242 Label retry;
9249 // If the returned exception is RETRY_AFTER_GC continue at retry label 9243 // If the returned exception is RETRY_AFTER_GC continue at retry label
9250 ASSERT(Failure::RETRY_AFTER_GC == 0); 9244 ASSERT(Failure::RETRY_AFTER_GC == 0);
9251 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); 9245 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize));
9252 __ j(zero, &retry, taken); 9246 __ j(zero, &retry, taken);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
9319 // Restore fp from handler and discard handler state. 9313 // Restore fp from handler and discard handler state.
9320 ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); 9314 ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
9321 __ pop(ebp); 9315 __ pop(ebp);
9322 __ pop(edx); // State. 9316 __ pop(edx); // State.
9323 9317
9324 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); 9318 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
9325 __ ret(0); 9319 __ ret(0);
9326 } 9320 }
9327 9321
9328 9322
9329 void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { 9323 void CEntryStub::Generate(MacroAssembler* masm) {
9330 // eax: number of arguments including receiver 9324 // eax: number of arguments including receiver
9331 // ebx: pointer to C function (C callee-saved) 9325 // ebx: pointer to C function (C callee-saved)
9332 // ebp: frame pointer (restored after C call) 9326 // ebp: frame pointer (restored after C call)
9333 // esp: stack pointer (restored after C call) 9327 // esp: stack pointer (restored after C call)
9334 // esi: current context (C callee-saved) 9328 // esi: current context (C callee-saved)
9335 // edi: JS function of the caller (C callee-saved) 9329 // edi: JS function of the caller (C callee-saved)
9336 9330
9337 // NOTE: Invocations of builtins may return failure objects instead 9331 // NOTE: Invocations of builtins may return failure objects instead
9338 // of a proper result. The builtin entry handles this by performing 9332 // of a proper result. The builtin entry handles this by performing
9339 // a garbage collection and retrying the builtin (twice). 9333 // a garbage collection and retrying the builtin (twice).
9340 9334
9341 ExitFrame::Mode mode = is_debug_break
9342 ? ExitFrame::MODE_DEBUG
9343 : ExitFrame::MODE_NORMAL;
9344
9345 // Enter the exit frame that transitions from JavaScript to C++. 9335 // Enter the exit frame that transitions from JavaScript to C++.
9346 __ EnterExitFrame(mode); 9336 __ EnterExitFrame(mode_);
9347 9337
9348 // eax: result parameter for PerformGC, if any (setup below) 9338 // eax: result parameter for PerformGC, if any (setup below)
9349 // ebx: pointer to builtin function (C callee-saved) 9339 // ebx: pointer to builtin function (C callee-saved)
9350 // ebp: frame pointer (restored after C call) 9340 // ebp: frame pointer (restored after C call)
9351 // esp: stack pointer (restored after C call) 9341 // esp: stack pointer (restored after C call)
9352 // edi: number of arguments including receiver (C callee-saved) 9342 // edi: number of arguments including receiver (C callee-saved)
9353 // esi: argv pointer (C callee-saved) 9343 // esi: argv pointer (C callee-saved)
9354 9344
9355 Label throw_normal_exception; 9345 Label throw_normal_exception;
9356 Label throw_termination_exception; 9346 Label throw_termination_exception;
9357 Label throw_out_of_memory_exception; 9347 Label throw_out_of_memory_exception;
9358 9348
9359 // Call into the runtime system. 9349 // Call into the runtime system.
9360 GenerateCore(masm, 9350 GenerateCore(masm,
9361 &throw_normal_exception, 9351 &throw_normal_exception,
9362 &throw_termination_exception, 9352 &throw_termination_exception,
9363 &throw_out_of_memory_exception, 9353 &throw_out_of_memory_exception,
9364 mode,
9365 false, 9354 false,
9366 false); 9355 false);
9367 9356
9368 // Do space-specific GC and retry runtime call. 9357 // Do space-specific GC and retry runtime call.
9369 GenerateCore(masm, 9358 GenerateCore(masm,
9370 &throw_normal_exception, 9359 &throw_normal_exception,
9371 &throw_termination_exception, 9360 &throw_termination_exception,
9372 &throw_out_of_memory_exception, 9361 &throw_out_of_memory_exception,
9373 mode,
9374 true, 9362 true,
9375 false); 9363 false);
9376 9364
9377 // Do full GC and retry runtime call one final time. 9365 // Do full GC and retry runtime call one final time.
9378 Failure* failure = Failure::InternalError(); 9366 Failure* failure = Failure::InternalError();
9379 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure))); 9367 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure)));
9380 GenerateCore(masm, 9368 GenerateCore(masm,
9381 &throw_normal_exception, 9369 &throw_normal_exception,
9382 &throw_termination_exception, 9370 &throw_termination_exception,
9383 &throw_out_of_memory_exception, 9371 &throw_out_of_memory_exception,
9384 mode,
9385 true, 9372 true,
9386 true); 9373 true);
9387 9374
9388 __ bind(&throw_out_of_memory_exception); 9375 __ bind(&throw_out_of_memory_exception);
9389 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); 9376 GenerateThrowUncatchable(masm, OUT_OF_MEMORY);
9390 9377
9391 __ bind(&throw_termination_exception); 9378 __ bind(&throw_termination_exception);
9392 GenerateThrowUncatchable(masm, TERMINATION); 9379 GenerateThrowUncatchable(masm, TERMINATION);
9393 9380
9394 __ bind(&throw_normal_exception); 9381 __ bind(&throw_normal_exception);
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
10103 10090
10104 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 10091 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
10105 // tagged as a small integer. 10092 // tagged as a small integer.
10106 __ bind(&runtime); 10093 __ bind(&runtime);
10107 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); 10094 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1);
10108 } 10095 }
10109 10096
10110 #undef __ 10097 #undef __
10111 10098
10112 } } // namespace v8::internal 10099 } } // namespace v8::internal
OLDNEW
« src/codegen.cc ('K') | « src/heap.cc ('k') | src/ia32/debug-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698