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 5826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5837 | 5837 |
5838 void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) { | 5838 void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) { |
5839 ASSERT_EQ(args->length(), 1); | 5839 ASSERT_EQ(args->length(), 1); |
5840 Load(args->at(0)); | 5840 Load(args->at(0)); |
5841 TranscendentalCacheStub stub(TranscendentalCache::COS); | 5841 TranscendentalCacheStub stub(TranscendentalCache::COS); |
5842 Result result = frame_->CallStub(&stub, 1); | 5842 Result result = frame_->CallStub(&stub, 1); |
5843 frame_->Push(&result); | 5843 frame_->Push(&result); |
5844 } | 5844 } |
5845 | 5845 |
5846 | 5846 |
| 5847 void CodeGenerator::GenerateIsIdentical(ZoneList<Expression*>* args) { |
| 5848 ASSERT_EQ(args->length(), 2); |
| 5849 JumpTarget failure; |
| 5850 JumpTarget done; |
| 5851 |
| 5852 Load(args->at(0)); |
| 5853 Load(args->at(1)); |
| 5854 |
| 5855 Result arg2 = frame_->Pop(); |
| 5856 Result arg1 = frame_->Pop(); |
| 5857 arg2.ToRegister(); |
| 5858 arg1.ToRegister(); |
| 5859 __ cmp(arg1.reg(), Operand(arg2.reg())); |
| 5860 arg1.Unuse(); |
| 5861 arg2.Unuse(); |
| 5862 failure.Branch(not_equal); |
| 5863 |
| 5864 frame_->Push(Factory::true_value()); |
| 5865 done.Jump(); |
| 5866 |
| 5867 failure.Bind(); |
| 5868 frame_->Push(Factory::false_value()); |
| 5869 done.Bind(); |
| 5870 } |
| 5871 |
| 5872 |
| 5873 void CodeGenerator::GenerateRegExpId(ZoneList<Expression*>* args) { |
| 5874 // If passed a JSRegExp, return a value that uniquely identifies |
| 5875 // the regexp's behavior (i.e., two regexps returning the same value |
| 5876 // will also behave the same). Otherwise, return some arbitrary value. |
| 5877 ASSERT_EQ(args->length(), 1); |
| 5878 Label done; |
| 5879 Load(args->at(0)); |
| 5880 Result arg = frame_->Pop(); |
| 5881 arg.ToRegister(); |
| 5882 frame_->Spill(arg.reg()); |
| 5883 Result tmp = allocator()->Allocate(); |
| 5884 ASSERT(tmp.is_valid()); |
| 5885 |
| 5886 ASSERT_EQ(0, kSmiTag); |
| 5887 ASSERT_EQ(1, kSmiTagMask); |
| 5888 __ test(arg.reg(), Immediate(kSmiTagMask)); |
| 5889 __ j(zero, &done); |
| 5890 __ mov(tmp.reg(), FieldOperand(arg.reg(), HeapObject::kMapOffset)); |
| 5891 __ cmpb(FieldOperand(tmp.reg(), Map::kInstanceTypeOffset), |
| 5892 static_cast<uint8_t>(JS_REGEXP_TYPE)); |
| 5893 __ j(not_equal, &done); |
| 5894 __ mov(arg.reg(), FieldOperand(arg.reg(), JSRegExp::kDataOffset)); |
| 5895 ASSERT_EQ(3, kHeapObjectTagMask); |
| 5896 ASSERT_EQ(1, kHeapObjectTag); |
| 5897 // Convert FixedArray address to smi. |
| 5898 __ sar(arg.reg(), 1); |
| 5899 __ bind(&done); |
| 5900 frame_->Push(arg.reg(), NumberInfo::kSmi); |
| 5901 arg.Unuse(); |
| 5902 } |
| 5903 |
| 5904 |
| 5905 |
5847 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { | 5906 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { |
5848 if (CheckForInlineRuntimeCall(node)) { | 5907 if (CheckForInlineRuntimeCall(node)) { |
5849 return; | 5908 return; |
5850 } | 5909 } |
5851 | 5910 |
5852 ZoneList<Expression*>* args = node->arguments(); | 5911 ZoneList<Expression*>* args = node->arguments(); |
5853 Comment cmnt(masm_, "[ CallRuntime"); | 5912 Comment cmnt(masm_, "[ CallRuntime"); |
5854 Runtime::Function* function = node->function(); | 5913 Runtime::Function* function = node->function(); |
5855 | 5914 |
5856 if (function == NULL) { | 5915 if (function == NULL) { |
(...skipping 5158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11015 | 11074 |
11016 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 11075 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
11017 // tagged as a small integer. | 11076 // tagged as a small integer. |
11018 __ bind(&runtime); | 11077 __ bind(&runtime); |
11019 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 11078 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
11020 } | 11079 } |
11021 | 11080 |
11022 #undef __ | 11081 #undef __ |
11023 | 11082 |
11024 } } // namespace v8::internal | 11083 } } // namespace v8::internal |
OLD | NEW |