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

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

Issue 8700: As discussed on the phone, I'd like your thoughts on the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 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/codegen-arm.cc ('k') | src/heap.h » ('j') | src/heap.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 4791 matching lines...) Expand 10 before | Expand all | Expand 10 after
4802 __ bind(&skip); 4802 __ bind(&skip);
4803 4803
4804 __ ret(0); 4804 __ ret(0);
4805 } 4805 }
4806 4806
4807 4807
4808 void CEntryStub::GenerateCore(MacroAssembler* masm, 4808 void CEntryStub::GenerateCore(MacroAssembler* masm,
4809 Label* throw_normal_exception, 4809 Label* throw_normal_exception,
4810 Label* throw_out_of_memory_exception, 4810 Label* throw_out_of_memory_exception,
4811 StackFrame::Type frame_type, 4811 StackFrame::Type frame_type,
4812 bool do_gc) { 4812 bool do_gc,
4813 bool always_allocate_scope) {
4813 // eax: result parameter for PerformGC, if any 4814 // eax: result parameter for PerformGC, if any
4814 // ebx: pointer to C function (C callee-saved) 4815 // ebx: pointer to C function (C callee-saved)
4815 // ebp: frame pointer (restored after C call) 4816 // ebp: frame pointer (restored after C call)
4816 // esp: stack pointer (restored after C call) 4817 // esp: stack pointer (restored after C call)
4817 // edi: number of arguments including receiver (C callee-saved) 4818 // edi: number of arguments including receiver (C callee-saved)
4818 // esi: pointer to the first argument (C callee-saved) 4819 // esi: pointer to the first argument (C callee-saved)
4819 4820
4820 if (do_gc) { 4821 if (do_gc) {
4821 __ mov(Operand(esp, 0 * kPointerSize), eax); // Result. 4822 __ mov(Operand(esp, 0 * kPointerSize), eax); // Result.
4822 __ call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); 4823 __ call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY);
4823 } 4824 }
4824 4825
4826 ExternalReference scope_depth =
4827 ExternalReference::heap_always_allocate_scope_depth();
4828 if (always_allocate_scope) {
4829 __ inc(Operand::StaticVariable(scope_depth));
4830 }
4831
4825 // Call C function. 4832 // Call C function.
4826 __ mov(Operand(esp, 0 * kPointerSize), edi); // argc. 4833 __ mov(Operand(esp, 0 * kPointerSize), edi); // argc.
4827 __ mov(Operand(esp, 1 * kPointerSize), esi); // argv. 4834 __ mov(Operand(esp, 1 * kPointerSize), esi); // argv.
4828 __ call(Operand(ebx)); 4835 __ call(Operand(ebx));
4829 // Result is in eax or edx:eax - do not destroy these registers! 4836 // Result is in eax or edx:eax - do not destroy these registers!
4830 4837
4838 if (always_allocate_scope) {
4839 __ dec(Operand::StaticVariable(scope_depth));
4840 }
4841
4831 // Check for failure result. 4842 // Check for failure result.
4832 Label failure_returned; 4843 Label failure_returned;
4833 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); 4844 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0);
4834 __ lea(ecx, Operand(eax, 1)); 4845 __ lea(ecx, Operand(eax, 1));
4835 // Lower 2 bits of ecx are 0 iff eax has failure tag. 4846 // Lower 2 bits of ecx are 0 iff eax has failure tag.
4836 __ test(ecx, Immediate(kFailureTagMask)); 4847 __ test(ecx, Immediate(kFailureTagMask));
4837 __ j(zero, &failure_returned, not_taken); 4848 __ j(zero, &failure_returned, not_taken);
4838 4849
4839 // Exit the JavaScript to C++ exit frame. 4850 // Exit the JavaScript to C++ exit frame.
4840 __ LeaveExitFrame(frame_type); 4851 __ LeaveExitFrame(frame_type);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4956 4967
4957 // Call into the runtime system. Collect garbage before the call if 4968 // Call into the runtime system. Collect garbage before the call if
4958 // running with --gc-greedy set. 4969 // running with --gc-greedy set.
4959 if (FLAG_gc_greedy) { 4970 if (FLAG_gc_greedy) {
4960 Failure* failure = Failure::RetryAfterGC(0); 4971 Failure* failure = Failure::RetryAfterGC(0);
4961 __ mov(Operand(eax), Immediate(reinterpret_cast<int32_t>(failure))); 4972 __ mov(Operand(eax), Immediate(reinterpret_cast<int32_t>(failure)));
4962 } 4973 }
4963 GenerateCore(masm, &throw_normal_exception, 4974 GenerateCore(masm, &throw_normal_exception,
4964 &throw_out_of_memory_exception, 4975 &throw_out_of_memory_exception,
4965 frame_type, 4976 frame_type,
4966 FLAG_gc_greedy); 4977 FLAG_gc_greedy,
4978 false);
4967 4979
4968 // Do space-specific GC and retry runtime call. 4980 // Do space-specific GC and retry runtime call.
4969 GenerateCore(masm, 4981 GenerateCore(masm,
4970 &throw_normal_exception, 4982 &throw_normal_exception,
4971 &throw_out_of_memory_exception, 4983 &throw_out_of_memory_exception,
4972 frame_type, 4984 frame_type,
4973 true); 4985 true,
4986 false);
4974 4987
4975 // Do full GC and retry runtime call one final time. 4988 // Do full GC and retry runtime call one final time.
4976 Failure* failure = Failure::InternalError(); 4989 Failure* failure = Failure::InternalError();
4977 __ mov(Operand(eax), Immediate(reinterpret_cast<int32_t>(failure))); 4990 __ mov(Operand(eax), Immediate(reinterpret_cast<int32_t>(failure)));
4978 GenerateCore(masm, 4991 GenerateCore(masm,
4979 &throw_normal_exception, 4992 &throw_normal_exception,
4980 &throw_out_of_memory_exception, 4993 &throw_out_of_memory_exception,
4981 frame_type, 4994 frame_type,
4995 true,
4982 true); 4996 true);
4983 4997
4984 __ bind(&throw_out_of_memory_exception); 4998 __ bind(&throw_out_of_memory_exception);
4985 GenerateThrowOutOfMemory(masm); 4999 GenerateThrowOutOfMemory(masm);
4986 // control flow for generated will not return. 5000 // control flow for generated will not return.
4987 5001
4988 __ bind(&throw_normal_exception); 5002 __ bind(&throw_normal_exception);
4989 GenerateThrowTOS(masm); 5003 GenerateThrowTOS(masm);
4990 } 5004 }
4991 5005
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
5120 5134
5121 // Slow-case: Go through the JavaScript implementation. 5135 // Slow-case: Go through the JavaScript implementation.
5122 __ bind(&slow); 5136 __ bind(&slow);
5123 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 5137 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
5124 } 5138 }
5125 5139
5126 5140
5127 #undef __ 5141 #undef __
5128 5142
5129 } } // namespace v8::internal 5143 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen-arm.cc ('k') | src/heap.h » ('j') | src/heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698