OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 | 803 |
804 | 804 |
805 void LCodeGen::DoBitNotI(LBitNotI* instr) { | 805 void LCodeGen::DoBitNotI(LBitNotI* instr) { |
806 LOperand* input = instr->InputAt(0); | 806 LOperand* input = instr->InputAt(0); |
807 ASSERT(input->Equals(instr->result())); | 807 ASSERT(input->Equals(instr->result())); |
808 __ not_(ToRegister(input)); | 808 __ not_(ToRegister(input)); |
809 } | 809 } |
810 | 810 |
811 | 811 |
812 void LCodeGen::DoThrow(LThrow* instr) { | 812 void LCodeGen::DoThrow(LThrow* instr) { |
813 Abort("Unimplemented: %s", "DoThrow"); | 813 __ push(ToRegister(instr->InputAt(0))); |
| 814 CallRuntime(Runtime::kThrow, 1, instr); |
| 815 |
| 816 if (FLAG_debug_code) { |
| 817 Comment("Unreachable code."); |
| 818 __ int3(); |
| 819 } |
814 } | 820 } |
815 | 821 |
816 | 822 |
817 void LCodeGen::DoAddI(LAddI* instr) { | 823 void LCodeGen::DoAddI(LAddI* instr) { |
818 LOperand* left = instr->InputAt(0); | 824 LOperand* left = instr->InputAt(0); |
819 LOperand* right = instr->InputAt(1); | 825 LOperand* right = instr->InputAt(1); |
820 ASSERT(left->Equals(instr->result())); | 826 ASSERT(left->Equals(instr->result())); |
821 | 827 |
822 if (right->IsConstantOperand()) { | 828 if (right->IsConstantOperand()) { |
823 __ addl(ToRegister(left), | 829 __ addl(ToRegister(left), |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 __ jmp(deferred_stack_check->entry()); | 962 __ jmp(deferred_stack_check->entry()); |
957 deferred_stack_check->SetExit(chunk_->GetAssemblyLabel(block)); | 963 deferred_stack_check->SetExit(chunk_->GetAssemblyLabel(block)); |
958 } else { | 964 } else { |
959 __ jmp(chunk_->GetAssemblyLabel(block)); | 965 __ jmp(chunk_->GetAssemblyLabel(block)); |
960 } | 966 } |
961 } | 967 } |
962 } | 968 } |
963 | 969 |
964 | 970 |
965 void LCodeGen::DoDeferredStackCheck(LGoto* instr) { | 971 void LCodeGen::DoDeferredStackCheck(LGoto* instr) { |
966 Abort("Unimplemented: %s", "DoDeferredStackCheck"); | 972 __ Pushad(); |
| 973 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
| 974 RecordSafepointWithRegisters( |
| 975 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex); |
| 976 __ Popad(); |
967 } | 977 } |
968 | 978 |
969 | 979 |
970 void LCodeGen::DoGoto(LGoto* instr) { | 980 void LCodeGen::DoGoto(LGoto* instr) { |
971 class DeferredStackCheck: public LDeferredCode { | 981 class DeferredStackCheck: public LDeferredCode { |
972 public: | 982 public: |
973 DeferredStackCheck(LCodeGen* codegen, LGoto* instr) | 983 DeferredStackCheck(LCodeGen* codegen, LGoto* instr) |
974 : LDeferredCode(codegen), instr_(instr) { } | 984 : LDeferredCode(codegen), instr_(instr) { } |
975 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 985 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } |
976 private: | 986 private: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 | 1025 |
1016 void LCodeGen::EmitCmpI(LOperand* left, LOperand* right) { | 1026 void LCodeGen::EmitCmpI(LOperand* left, LOperand* right) { |
1017 if (right->IsConstantOperand()) { | 1027 if (right->IsConstantOperand()) { |
1018 int32_t value = ToInteger32(LConstantOperand::cast(right)); | 1028 int32_t value = ToInteger32(LConstantOperand::cast(right)); |
1019 if (left->IsRegister()) { | 1029 if (left->IsRegister()) { |
1020 __ cmpl(ToRegister(left), Immediate(value)); | 1030 __ cmpl(ToRegister(left), Immediate(value)); |
1021 } else { | 1031 } else { |
1022 __ cmpl(ToOperand(left), Immediate(value)); | 1032 __ cmpl(ToOperand(left), Immediate(value)); |
1023 } | 1033 } |
1024 } else if (right->IsRegister()) { | 1034 } else if (right->IsRegister()) { |
1025 __ cmpq(ToRegister(left), ToRegister(right)); | 1035 __ cmpl(ToRegister(left), ToRegister(right)); |
1026 } else { | 1036 } else { |
1027 __ cmpq(ToRegister(left), ToOperand(right)); | 1037 __ cmpl(ToRegister(left), ToOperand(right)); |
1028 } | 1038 } |
1029 } | 1039 } |
1030 | 1040 |
1031 | 1041 |
1032 void LCodeGen::DoCmpID(LCmpID* instr) { | 1042 void LCodeGen::DoCmpID(LCmpID* instr) { |
1033 LOperand* left = instr->InputAt(0); | 1043 LOperand* left = instr->InputAt(0); |
1034 LOperand* right = instr->InputAt(1); | 1044 LOperand* right = instr->InputAt(1); |
1035 LOperand* result = instr->result(); | 1045 LOperand* result = instr->result(); |
1036 | 1046 |
1037 NearLabel unordered; | 1047 NearLabel unordered; |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 if (instr->length()->IsRegister()) { | 1872 if (instr->length()->IsRegister()) { |
1863 __ cmpq(ToRegister(instr->index()), ToRegister(instr->length())); | 1873 __ cmpq(ToRegister(instr->index()), ToRegister(instr->length())); |
1864 } else { | 1874 } else { |
1865 __ cmpq(ToRegister(instr->index()), ToOperand(instr->length())); | 1875 __ cmpq(ToRegister(instr->index()), ToOperand(instr->length())); |
1866 } | 1876 } |
1867 DeoptimizeIf(above_equal, instr->environment()); | 1877 DeoptimizeIf(above_equal, instr->environment()); |
1868 } | 1878 } |
1869 | 1879 |
1870 | 1880 |
1871 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { | 1881 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { |
1872 Abort("Unimplemented: %s", "DoStoreKeyedFastElement"); | 1882 Register value = ToRegister(instr->value()); |
| 1883 Register elements = ToRegister(instr->object()); |
| 1884 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; |
| 1885 |
| 1886 // Do the store. |
| 1887 if (instr->key()->IsConstantOperand()) { |
| 1888 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 1889 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
| 1890 int offset = |
| 1891 ToInteger32(const_operand) * kPointerSize + FixedArray::kHeaderSize; |
| 1892 __ movq(FieldOperand(elements, offset), value); |
| 1893 } else { |
| 1894 __ movq(FieldOperand(elements, |
| 1895 key, |
| 1896 times_pointer_size, |
| 1897 FixedArray::kHeaderSize), |
| 1898 value); |
| 1899 } |
| 1900 |
| 1901 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 1902 // Compute address of modified element and store it into key register. |
| 1903 __ lea(key, FieldOperand(elements, |
| 1904 key, |
| 1905 times_pointer_size, |
| 1906 FixedArray::kHeaderSize)); |
| 1907 __ RecordWrite(elements, key, value); |
| 1908 } |
1873 } | 1909 } |
1874 | 1910 |
1875 | 1911 |
1876 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 1912 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
1877 Abort("Unimplemented: %s", "DoStoreKeyedGeneric"); | 1913 Abort("Unimplemented: %s", "DoStoreKeyedGeneric"); |
1878 } | 1914 } |
1879 | 1915 |
1880 | 1916 |
1881 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { | 1917 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
1882 LOperand* input = instr->InputAt(0); | 1918 LOperand* input = instr->InputAt(0); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2359 | 2395 |
2360 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2396 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
2361 Abort("Unimplemented: %s", "DoOsrEntry"); | 2397 Abort("Unimplemented: %s", "DoOsrEntry"); |
2362 } | 2398 } |
2363 | 2399 |
2364 #undef __ | 2400 #undef __ |
2365 | 2401 |
2366 } } // namespace v8::internal | 2402 } } // namespace v8::internal |
2367 | 2403 |
2368 #endif // V8_TARGET_ARCH_X64 | 2404 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |