Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1034 | 1034 |
| 1035 case Token::SUB: { | 1035 case Token::SUB: { |
| 1036 DeferredCode* deferred = NULL; | 1036 DeferredCode* deferred = NULL; |
| 1037 frame_->Pop(eax); | 1037 frame_->Pop(eax); |
| 1038 if (!reversed) { | 1038 if (!reversed) { |
| 1039 deferred = new DeferredInlinedSmiSub(this, int_value, overwrite_mode); | 1039 deferred = new DeferredInlinedSmiSub(this, int_value, overwrite_mode); |
| 1040 __ sub(Operand(eax), Immediate(value)); | 1040 __ sub(Operand(eax), Immediate(value)); |
| 1041 } else { | 1041 } else { |
| 1042 deferred = new DeferredInlinedSmiSubReversed(this, edx, overwrite_mode); | 1042 deferred = new DeferredInlinedSmiSubReversed(this, edx, overwrite_mode); |
| 1043 __ mov(edx, Operand(eax)); | 1043 __ mov(edx, Operand(eax)); |
| 1044 __ mov(Operand(eax), Immediate(value)); | 1044 __ mov(eax, Immediate(value)); |
|
Kevin Millikin (Chromium)
2008/11/10 15:05:41
Couldn't this just be __ mov(eax, value)?
| |
| 1045 __ sub(eax, Operand(edx)); | 1045 __ sub(eax, Operand(edx)); |
| 1046 } | 1046 } |
| 1047 __ j(overflow, deferred->enter(), not_taken); | 1047 __ j(overflow, deferred->enter(), not_taken); |
| 1048 __ test(eax, Immediate(kSmiTagMask)); | 1048 __ test(eax, Immediate(kSmiTagMask)); |
| 1049 __ j(not_zero, deferred->enter(), not_taken); | 1049 __ j(not_zero, deferred->enter(), not_taken); |
| 1050 __ bind(deferred->exit()); | 1050 __ bind(deferred->exit()); |
| 1051 frame_->Push(eax); | 1051 frame_->Push(eax); |
| 1052 break; | 1052 break; |
| 1053 } | 1053 } |
| 1054 | 1054 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1258 Condition cc_; | 1258 Condition cc_; |
| 1259 bool strict_; | 1259 bool strict_; |
| 1260 int value_; | 1260 int value_; |
| 1261 }; | 1261 }; |
| 1262 | 1262 |
| 1263 | 1263 |
| 1264 void SmiComparisonDeferred::Generate() { | 1264 void SmiComparisonDeferred::Generate() { |
| 1265 CompareStub stub(cc_, strict_); | 1265 CompareStub stub(cc_, strict_); |
| 1266 // Setup parameters and call stub. | 1266 // Setup parameters and call stub. |
| 1267 __ mov(edx, Operand(eax)); | 1267 __ mov(edx, Operand(eax)); |
| 1268 __ mov(Operand(eax), Immediate(Smi::FromInt(value_))); | 1268 __ Set(eax, Immediate(Smi::FromInt(value_))); |
| 1269 __ CallStub(&stub); | 1269 __ CallStub(&stub); |
| 1270 __ cmp(eax, 0); | 1270 __ cmp(eax, 0); |
| 1271 // "result" is returned in the flags | 1271 // "result" is returned in the flags |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 | 1274 |
| 1275 void CodeGenerator::SmiComparison(Condition cc, | 1275 void CodeGenerator::SmiComparison(Condition cc, |
| 1276 Handle<Object> value, | 1276 Handle<Object> value, |
| 1277 bool strict) { | 1277 bool strict) { |
| 1278 // Strict only makes sense for equality comparisons. | 1278 // Strict only makes sense for equality comparisons. |
| (...skipping 3698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4977 // edi: number of arguments including receiver (C callee-saved) | 4977 // edi: number of arguments including receiver (C callee-saved) |
| 4978 // esi: argv pointer (C callee-saved) | 4978 // esi: argv pointer (C callee-saved) |
| 4979 | 4979 |
| 4980 Label throw_out_of_memory_exception; | 4980 Label throw_out_of_memory_exception; |
| 4981 Label throw_normal_exception; | 4981 Label throw_normal_exception; |
| 4982 | 4982 |
| 4983 // Call into the runtime system. Collect garbage before the call if | 4983 // Call into the runtime system. Collect garbage before the call if |
| 4984 // running with --gc-greedy set. | 4984 // running with --gc-greedy set. |
| 4985 if (FLAG_gc_greedy) { | 4985 if (FLAG_gc_greedy) { |
| 4986 Failure* failure = Failure::RetryAfterGC(0); | 4986 Failure* failure = Failure::RetryAfterGC(0); |
| 4987 __ mov(Operand(eax), Immediate(reinterpret_cast<int32_t>(failure))); | 4987 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure))); |
|
Kevin Millikin (Chromium)
2008/11/10 15:05:41
Similarly __ mov(eax, reinterpret_cast<int32_t>(fa
| |
| 4988 } | 4988 } |
| 4989 GenerateCore(masm, &throw_normal_exception, | 4989 GenerateCore(masm, &throw_normal_exception, |
| 4990 &throw_out_of_memory_exception, | 4990 &throw_out_of_memory_exception, |
| 4991 frame_type, | 4991 frame_type, |
| 4992 FLAG_gc_greedy, | 4992 FLAG_gc_greedy, |
| 4993 false); | 4993 false); |
| 4994 | 4994 |
| 4995 // Do space-specific GC and retry runtime call. | 4995 // Do space-specific GC and retry runtime call. |
| 4996 GenerateCore(masm, | 4996 GenerateCore(masm, |
| 4997 &throw_normal_exception, | 4997 &throw_normal_exception, |
| 4998 &throw_out_of_memory_exception, | 4998 &throw_out_of_memory_exception, |
| 4999 frame_type, | 4999 frame_type, |
| 5000 true, | 5000 true, |
| 5001 false); | 5001 false); |
| 5002 | 5002 |
| 5003 // Do full GC and retry runtime call one final time. | 5003 // Do full GC and retry runtime call one final time. |
| 5004 Failure* failure = Failure::InternalError(); | 5004 Failure* failure = Failure::InternalError(); |
| 5005 __ mov(Operand(eax), Immediate(reinterpret_cast<int32_t>(failure))); | 5005 __ mov(eax, Immediate(reinterpret_cast<int32_t>(failure))); |
|
Kevin Millikin (Chromium)
2008/11/10 15:05:41
Ditto.
| |
| 5006 GenerateCore(masm, | 5006 GenerateCore(masm, |
| 5007 &throw_normal_exception, | 5007 &throw_normal_exception, |
| 5008 &throw_out_of_memory_exception, | 5008 &throw_out_of_memory_exception, |
| 5009 frame_type, | 5009 frame_type, |
| 5010 true, | 5010 true, |
| 5011 true); | 5011 true); |
| 5012 | 5012 |
| 5013 __ bind(&throw_out_of_memory_exception); | 5013 __ bind(&throw_out_of_memory_exception); |
| 5014 GenerateThrowOutOfMemory(masm); | 5014 GenerateThrowOutOfMemory(masm); |
| 5015 // control flow for generated will not return. | 5015 // control flow for generated will not return. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5061 | 5061 |
| 5062 // Fake a receiver (NULL). | 5062 // Fake a receiver (NULL). |
| 5063 __ push(Immediate(0)); // receiver | 5063 __ push(Immediate(0)); // receiver |
| 5064 | 5064 |
| 5065 // Invoke the function by calling through JS entry trampoline | 5065 // Invoke the function by calling through JS entry trampoline |
| 5066 // builtin and pop the faked function when we return. Notice that we | 5066 // builtin and pop the faked function when we return. Notice that we |
| 5067 // cannot store a reference to the trampoline code directly in this | 5067 // cannot store a reference to the trampoline code directly in this |
| 5068 // stub, because the builtin stubs may not have been generated yet. | 5068 // stub, because the builtin stubs may not have been generated yet. |
| 5069 if (is_construct) { | 5069 if (is_construct) { |
| 5070 ExternalReference construct_entry(Builtins::JSConstructEntryTrampoline); | 5070 ExternalReference construct_entry(Builtins::JSConstructEntryTrampoline); |
| 5071 __ mov(Operand(edx), Immediate(construct_entry)); | 5071 __ mov(edx, Immediate(construct_entry)); |
| 5072 } else { | 5072 } else { |
| 5073 ExternalReference entry(Builtins::JSEntryTrampoline); | 5073 ExternalReference entry(Builtins::JSEntryTrampoline); |
| 5074 __ mov(Operand(edx), Immediate(entry)); | 5074 __ mov(edx, Immediate(entry)); |
| 5075 } | 5075 } |
| 5076 __ mov(edx, Operand(edx, 0)); // deref address | 5076 __ mov(edx, Operand(edx, 0)); // deref address |
| 5077 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 5077 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
| 5078 __ call(Operand(edx)); | 5078 __ call(Operand(edx)); |
| 5079 | 5079 |
| 5080 // Unlink this frame from the handler chain. | 5080 // Unlink this frame from the handler chain. |
| 5081 __ pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address))); | 5081 __ pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address))); |
| 5082 // Pop next_sp. | 5082 // Pop next_sp. |
| 5083 __ add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); | 5083 __ add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); |
| 5084 | 5084 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5149 | 5149 |
| 5150 // Slow-case: Go through the JavaScript implementation. | 5150 // Slow-case: Go through the JavaScript implementation. |
| 5151 __ bind(&slow); | 5151 __ bind(&slow); |
| 5152 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5152 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 5153 } | 5153 } |
| 5154 | 5154 |
| 5155 | 5155 |
| 5156 #undef __ | 5156 #undef __ |
| 5157 | 5157 |
| 5158 } } // namespace v8::internal | 5158 } } // namespace v8::internal |
| OLD | NEW |