| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 __ j(greater, &negative, Label::kNear); | 509 __ j(greater, &negative, Label::kNear); |
| 510 __ mov(ecx, scratch2); | 510 __ mov(ecx, scratch2); |
| 511 __ jmp(&done, Label::kNear); | 511 __ jmp(&done, Label::kNear); |
| 512 __ bind(&negative); | 512 __ bind(&negative); |
| 513 __ sub(ecx, Operand(scratch2)); | 513 __ sub(ecx, Operand(scratch2)); |
| 514 __ bind(&done); | 514 __ bind(&done); |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 | 517 |
| 518 | 518 |
| 519 Handle<Code> GetUnaryOpStub(int key, UnaryOpIC::TypeInfo type_info) { | |
| 520 UnaryOpStub stub(key, type_info); | |
| 521 return stub.GetCode(); | |
| 522 } | |
| 523 | |
| 524 | |
| 525 const char* UnaryOpStub::GetName() { | 519 const char* UnaryOpStub::GetName() { |
| 526 if (name_ != NULL) return name_; | 520 if (name_ != NULL) return name_; |
| 527 const int kMaxNameLength = 100; | 521 const int kMaxNameLength = 100; |
| 528 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( | 522 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray( |
| 529 kMaxNameLength); | 523 kMaxNameLength); |
| 530 if (name_ == NULL) return "OOM"; | 524 if (name_ == NULL) return "OOM"; |
| 531 const char* op_name = Token::Name(op_); | 525 const char* op_name = Token::Name(op_); |
| 532 const char* overwrite_name = NULL; // Make g++ happy. | 526 const char* overwrite_name = NULL; // Make g++ happy. |
| 533 switch (mode_) { | 527 switch (mode_) { |
| 534 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; | 528 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 break; | 839 break; |
| 846 case Token::BIT_NOT: | 840 case Token::BIT_NOT: |
| 847 __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_FUNCTION); | 841 __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_FUNCTION); |
| 848 break; | 842 break; |
| 849 default: | 843 default: |
| 850 UNREACHABLE(); | 844 UNREACHABLE(); |
| 851 } | 845 } |
| 852 } | 846 } |
| 853 | 847 |
| 854 | 848 |
| 855 Handle<Code> GetBinaryOpStub(int key, | |
| 856 BinaryOpIC::TypeInfo type_info, | |
| 857 BinaryOpIC::TypeInfo result_type_info) { | |
| 858 BinaryOpStub stub(key, type_info, result_type_info); | |
| 859 return stub.GetCode(); | |
| 860 } | |
| 861 | |
| 862 | |
| 863 void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { | 849 void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { |
| 864 __ pop(ecx); // Save return address. | 850 __ pop(ecx); // Save return address. |
| 865 __ push(edx); | 851 __ push(edx); |
| 866 __ push(eax); | 852 __ push(eax); |
| 867 // Left and right arguments are now on top. | 853 // Left and right arguments are now on top. |
| 868 // Push this stub's key. Although the operation and the type info are | 854 // Push this stub's key. Although the operation and the type info are |
| 869 // encoded into the key, the encoding is opaque, so push them too. | 855 // encoded into the key, the encoding is opaque, so push them too. |
| 870 __ push(Immediate(Smi::FromInt(MinorKey()))); | 856 __ push(Immediate(Smi::FromInt(MinorKey()))); |
| 871 __ push(Immediate(Smi::FromInt(op_))); | 857 __ push(Immediate(Smi::FromInt(op_))); |
| 872 __ push(Immediate(Smi::FromInt(operands_type_))); | 858 __ push(Immediate(Smi::FromInt(operands_type_))); |
| (...skipping 5319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6192 __ Drop(1); | 6178 __ Drop(1); |
| 6193 __ ret(2 * kPointerSize); | 6179 __ ret(2 * kPointerSize); |
| 6194 } | 6180 } |
| 6195 | 6181 |
| 6196 | 6182 |
| 6197 #undef __ | 6183 #undef __ |
| 6198 | 6184 |
| 6199 } } // namespace v8::internal | 6185 } } // namespace v8::internal |
| 6200 | 6186 |
| 6201 #endif // V8_TARGET_ARCH_IA32 | 6187 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |