Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // as the map of the allocated object. 50 // as the map of the allocated object.
51 __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); 51 __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
52 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset)); 52 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
53 __ movq(rcx, Operand(rcx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX))); 53 __ movq(rcx, Operand(rcx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX)));
54 __ movq(FieldOperand(rax, JSObject::kMapOffset), rcx); 54 __ movq(FieldOperand(rax, JSObject::kMapOffset), rcx);
55 55
56 // Initialize the rest of the function. We don't have to update the 56 // Initialize the rest of the function. We don't have to update the
57 // write barrier because the allocated object is in new space. 57 // write barrier because the allocated object is in new space.
58 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); 58 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex);
59 __ LoadRoot(rcx, Heap::kTheHoleValueRootIndex); 59 __ LoadRoot(rcx, Heap::kTheHoleValueRootIndex);
60 __ LoadRoot(rdi, Heap::kUndefinedValueRootIndex);
60 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); 61 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), rbx);
61 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rbx); 62 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rbx);
62 __ movq(FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset), rcx); 63 __ movq(FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset), rcx);
63 __ movq(FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset), rdx); 64 __ movq(FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset), rdx);
64 __ movq(FieldOperand(rax, JSFunction::kContextOffset), rsi); 65 __ movq(FieldOperand(rax, JSFunction::kContextOffset), rsi);
65 __ movq(FieldOperand(rax, JSFunction::kLiteralsOffset), rbx); 66 __ movq(FieldOperand(rax, JSFunction::kLiteralsOffset), rbx);
67 __ movq(FieldOperand(rax, JSFunction::kNextFunctionLinkOffset), rdi);
66 68
67 // Initialize the code pointer in the function to be the one 69 // Initialize the code pointer in the function to be the one
68 // found in the shared function info object. 70 // found in the shared function info object.
69 __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); 71 __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset));
70 __ lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); 72 __ lea(rdx, FieldOperand(rdx, Code::kHeaderSize));
71 __ movq(FieldOperand(rax, JSFunction::kCodeEntryOffset), rdx); 73 __ movq(FieldOperand(rax, JSFunction::kCodeEntryOffset), rdx);
72 74
73 75
74 // Return and remove the on-stack parameter. 76 // Return and remove the on-stack parameter.
75 __ ret(1 * kPointerSize); 77 __ ret(1 * kPointerSize);
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 1); 979 1);
978 } 980 }
979 981
980 982
981 Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) { 983 Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) {
982 GenericBinaryOpStub stub(key, type_info); 984 GenericBinaryOpStub stub(key, type_info);
983 return stub.GetCode(); 985 return stub.GetCode();
984 } 986 }
985 987
986 988
989 Handle<Code> GetTypeRecordingBinaryOpStub(int key,
990 TRBinaryOpIC::TypeInfo type_info,
991 TRBinaryOpIC::TypeInfo result_type_info) {
992 UNIMPLEMENTED();
993 return Handle<Code>::null();
994 }
995
996
987 void TranscendentalCacheStub::Generate(MacroAssembler* masm) { 997 void TranscendentalCacheStub::Generate(MacroAssembler* masm) {
988 // Input on stack: 998 // Input on stack:
989 // rsp[8]: argument (should be number). 999 // rsp[8]: argument (should be number).
990 // rsp[0]: return address. 1000 // rsp[0]: return address.
991 Label runtime_call; 1001 Label runtime_call;
992 Label runtime_call_clear_stack; 1002 Label runtime_call_clear_stack;
993 Label input_not_smi; 1003 Label input_not_smi;
994 NearLabel loaded; 1004 NearLabel loaded;
995 // Test that rax is a number. 1005 // Test that rax is a number.
996 __ movq(rax, Operand(rsp, kPointerSize)); 1006 __ movq(rax, Operand(rsp, kPointerSize));
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 __ movq(rax, Operand(rsp, kLastMatchInfoOffset)); 2009 __ movq(rax, Operand(rsp, kLastMatchInfoOffset));
2000 __ ret(4 * kPointerSize); 2010 __ ret(4 * kPointerSize);
2001 2011
2002 // Do the runtime call to execute the regexp. 2012 // Do the runtime call to execute the regexp.
2003 __ bind(&runtime); 2013 __ bind(&runtime);
2004 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); 2014 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
2005 #endif // V8_INTERPRETED_REGEXP 2015 #endif // V8_INTERPRETED_REGEXP
2006 } 2016 }
2007 2017
2008 2018
2019 void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
2020 const int kMaxInlineLength = 100;
2021 Label slowcase;
2022 Label done;
2023 __ movq(r8, Operand(rsp, kPointerSize * 3));
2024 __ JumpIfNotSmi(r8, &slowcase);
2025 __ SmiToInteger32(rbx, r8);
2026 __ cmpl(rbx, Immediate(kMaxInlineLength));
2027 __ j(above, &slowcase);
2028 // Smi-tagging is equivalent to multiplying by 2.
2029 STATIC_ASSERT(kSmiTag == 0);
2030 STATIC_ASSERT(kSmiTagSize == 1);
2031 // Allocate RegExpResult followed by FixedArray with size in ebx.
2032 // JSArray: [Map][empty properties][Elements][Length-smi][index][input]
2033 // Elements: [Map][Length][..elements..]
2034 __ AllocateInNewSpace(JSRegExpResult::kSize + FixedArray::kHeaderSize,
2035 times_pointer_size,
2036 rbx, // In: Number of elements.
2037 rax, // Out: Start of allocation (tagged).
2038 rcx, // Out: End of allocation.
2039 rdx, // Scratch register
2040 &slowcase,
2041 TAG_OBJECT);
2042 // rax: Start of allocated area, object-tagged.
2043 // rbx: Number of array elements as int32.
2044 // r8: Number of array elements as smi.
2045
2046 // Set JSArray map to global.regexp_result_map().
2047 __ movq(rdx, ContextOperand(rsi, Context::GLOBAL_INDEX));
2048 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset));
2049 __ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX));
2050 __ movq(FieldOperand(rax, HeapObject::kMapOffset), rdx);
2051
2052 // Set empty properties FixedArray.
2053 __ Move(FieldOperand(rax, JSObject::kPropertiesOffset),
2054 FACTORY->empty_fixed_array());
2055
2056 // Set elements to point to FixedArray allocated right after the JSArray.
2057 __ lea(rcx, Operand(rax, JSRegExpResult::kSize));
2058 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rcx);
2059
2060 // Set input, index and length fields from arguments.
2061 __ movq(r8, Operand(rsp, kPointerSize * 1));
2062 __ movq(FieldOperand(rax, JSRegExpResult::kInputOffset), r8);
2063 __ movq(r8, Operand(rsp, kPointerSize * 2));
2064 __ movq(FieldOperand(rax, JSRegExpResult::kIndexOffset), r8);
2065 __ movq(r8, Operand(rsp, kPointerSize * 3));
2066 __ movq(FieldOperand(rax, JSArray::kLengthOffset), r8);
2067
2068 // Fill out the elements FixedArray.
2069 // rax: JSArray.
2070 // rcx: FixedArray.
2071 // rbx: Number of elements in array as int32.
2072
2073 // Set map.
2074 __ Move(FieldOperand(rcx, HeapObject::kMapOffset),
2075 FACTORY->fixed_array_map());
2076 // Set length.
2077 __ Integer32ToSmi(rdx, rbx);
2078 __ movq(FieldOperand(rcx, FixedArray::kLengthOffset), rdx);
2079 // Fill contents of fixed-array with the-hole.
2080 __ Move(rdx, FACTORY->the_hole_value());
2081 __ lea(rcx, FieldOperand(rcx, FixedArray::kHeaderSize));
2082 // Fill fixed array elements with hole.
2083 // rax: JSArray.
2084 // rbx: Number of elements in array that remains to be filled, as int32.
2085 // rcx: Start of elements in FixedArray.
2086 // rdx: the hole.
2087 Label loop;
2088 __ testl(rbx, rbx);
2089 __ bind(&loop);
2090 __ j(less_equal, &done); // Jump if ecx is negative or zero.
2091 __ subl(rbx, Immediate(1));
2092 __ movq(Operand(rcx, rbx, times_pointer_size, 0), rdx);
2093 __ jmp(&loop);
2094
2095 __ bind(&done);
2096 __ ret(3 * kPointerSize);
2097
2098 __ bind(&slowcase);
2099 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1);
2100 }
2101
2102
2009 void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm, 2103 void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm,
2010 Register object, 2104 Register object,
2011 Register result, 2105 Register result,
2012 Register scratch1, 2106 Register scratch1,
2013 Register scratch2, 2107 Register scratch2,
2014 bool object_is_smi, 2108 bool object_is_smi,
2015 Label* not_found) { 2109 Label* not_found) {
2016 // Use of registers. Register result is used as a temporary. 2110 // Use of registers. Register result is used as a temporary.
2017 Register number_string_cache = result; 2111 Register number_string_cache = result;
2018 Register mask = scratch1; 2112 Register mask = scratch1;
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after
3993 __ addq(rsp, Immediate(2 * kPointerSize)); 4087 __ addq(rsp, Immediate(2 * kPointerSize));
3994 __ push(rcx); 4088 __ push(rcx);
3995 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); 4089 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
3996 4090
3997 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 4091 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
3998 // tagged as a small integer. 4092 // tagged as a small integer.
3999 __ bind(&runtime); 4093 __ bind(&runtime);
4000 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4094 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
4001 } 4095 }
4002 4096
4097 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
4098 UNIMPLEMENTED();
4099 }
4100
4101
4102 void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) {
4103 UNIMPLEMENTED();
4104 }
4105
4106
4107 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
4108 UNIMPLEMENTED();
4109 }
4110
4111
4112 void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
4113 UNIMPLEMENTED();
4114 }
4115
4003 #undef __ 4116 #undef __
4004 4117
4005 } } // namespace v8::internal 4118 } } // namespace v8::internal
4006 4119
4007 #endif // V8_TARGET_ARCH_X64 4120 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698