Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 6039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6050 | 6050 |
| 6051 | 6051 |
| 6052 void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) { | 6052 void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) { |
| 6053 ASSERT_EQ(args->length(), 1); | 6053 ASSERT_EQ(args->length(), 1); |
| 6054 Load(args->at(0)); | 6054 Load(args->at(0)); |
| 6055 TranscendentalCacheStub stub(TranscendentalCache::COS); | 6055 TranscendentalCacheStub stub(TranscendentalCache::COS); |
| 6056 Result result = frame_->CallStub(&stub, 1); | 6056 Result result = frame_->CallStub(&stub, 1); |
| 6057 frame_->Push(&result); | 6057 frame_->Push(&result); |
| 6058 } | 6058 } |
| 6059 | 6059 |
| 6060 void CodeGenerator::GenerateNumberIsFinite(ZoneList<Expression*>* args) { | |
| 6061 ASSERT_EQ(args->length(), 1); | |
| 6062 Load(args->at(0)); | |
| 6063 Result num = frame_->Pop(); | |
| 6064 num.ToRegister(); | |
| 6065 Result result = allocator_->Allocate(); | |
| 6066 | |
| 6067 Label done; | |
| 6068 __ mov(result.reg(), Factory::true_value()); | |
| 6069 __ test(num.reg(), Immediate(kSmiTagMask)); | |
| 6070 ASSERT(kSmiTag == 0); | |
| 6071 __ j(zero, &done); | |
| 6072 | |
| 6073 // The number is finite if it is not a NaN or Infinite. Both values have | |
| 6074 // exponent 11111111111b. | |
| 6075 __ mov(num.reg(), FieldOperand(num.reg(), HeapNumber::kExponentOffset)); | |
| 6076 __ add(num.reg(), Operand(num.reg())); // Move exponent to the high bits. | |
| 6077 __ cmp(num.reg(), HeapNumber::kExponentMask << 1); | |
| 6078 | |
| 6079 if (CpuFeatures::IsSupported(CMOV)) { | |
| 6080 CpuFeatures::Scope use_cmov(CMOV); | |
|
Søren Thygesen Gjesse
2010/03/08 12:00:48
If it makes sense to use cmov here then please imp
| |
| 6081 __ mov(num.reg(), Factory::false_value()); | |
| 6082 __ cmov(above_equal, result.reg(), Operand(num.reg())); | |
| 6083 } else { | |
| 6084 __ j(below, &done); | |
| 6085 __ mov(result.reg(), Factory::false_value()); | |
| 6086 } | |
| 6087 | |
| 6088 __ bind(&done); | |
| 6089 frame_->Push(&result); | |
| 6090 } | |
| 6060 | 6091 |
| 6061 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { | 6092 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { |
| 6062 if (CheckForInlineRuntimeCall(node)) { | 6093 if (CheckForInlineRuntimeCall(node)) { |
| 6063 return; | 6094 return; |
| 6064 } | 6095 } |
| 6065 | 6096 |
| 6066 ZoneList<Expression*>* args = node->arguments(); | 6097 ZoneList<Expression*>* args = node->arguments(); |
| 6067 Comment cmnt(masm_, "[ CallRuntime"); | 6098 Comment cmnt(masm_, "[ CallRuntime"); |
| 6068 Runtime::Function* function = node->function(); | 6099 Runtime::Function* function = node->function(); |
| 6069 | 6100 |
| (...skipping 5314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11384 | 11415 |
| 11385 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 11416 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
| 11386 // tagged as a small integer. | 11417 // tagged as a small integer. |
| 11387 __ bind(&runtime); | 11418 __ bind(&runtime); |
| 11388 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 11419 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
| 11389 } | 11420 } |
| 11390 | 11421 |
| 11391 #undef __ | 11422 #undef __ |
| 11392 | 11423 |
| 11393 } } // namespace v8::internal | 11424 } } // namespace v8::internal |
| OLD | NEW |