OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 DCHECK(!AreAliased(r7, r8, LoadWithVectorDescriptor::VectorRegister(), | 1229 DCHECK(!AreAliased(r7, r8, LoadWithVectorDescriptor::VectorRegister(), |
1230 LoadWithVectorDescriptor::SlotRegister())); | 1230 LoadWithVectorDescriptor::SlotRegister())); |
1231 | 1231 |
1232 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r7, | 1232 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r7, |
1233 r8, &miss); | 1233 r8, &miss); |
1234 __ bind(&miss); | 1234 __ bind(&miss); |
1235 PropertyAccessCompiler::TailCallBuiltin( | 1235 PropertyAccessCompiler::TailCallBuiltin( |
1236 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); | 1236 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); |
1237 } | 1237 } |
1238 | 1238 |
1239 | |
1240 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { | |
1241 // Return address is in lr. | |
1242 Label miss; | |
1243 | |
1244 Register receiver = LoadDescriptor::ReceiverRegister(); | |
1245 Register index = LoadDescriptor::NameRegister(); | |
1246 Register scratch = r8; | |
1247 Register result = r3; | |
1248 DCHECK(!scratch.is(receiver) && !scratch.is(index)); | |
1249 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister()) && | |
1250 result.is(LoadWithVectorDescriptor::SlotRegister())); | |
1251 | |
1252 // StringCharAtGenerator doesn't use the result register until it's passed | |
1253 // the different miss possibilities. If it did, we would have a conflict | |
1254 // when FLAG_vector_ics is true. | |
1255 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | |
1256 &miss, // When not a string. | |
1257 &miss, // When not a number. | |
1258 &miss, // When index out of range. | |
1259 RECEIVER_IS_STRING); | |
1260 char_at_generator.GenerateFast(masm); | |
1261 __ Ret(); | |
1262 | |
1263 StubRuntimeCallHelper call_helper; | |
1264 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | |
1265 | |
1266 __ bind(&miss); | |
1267 PropertyAccessCompiler::TailCallBuiltin( | |
1268 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | |
1269 } | |
1270 | |
1271 | |
1272 void RegExpExecStub::Generate(MacroAssembler* masm) { | 1239 void RegExpExecStub::Generate(MacroAssembler* masm) { |
1273 // Just jump directly to runtime if native RegExp is not selected at compile | 1240 // Just jump directly to runtime if native RegExp is not selected at compile |
1274 // time or if regexp entry in generated code is turned off runtime switch or | 1241 // time or if regexp entry in generated code is turned off runtime switch or |
1275 // at compilation. | 1242 // at compilation. |
1276 #ifdef V8_INTERPRETED_REGEXP | 1243 #ifdef V8_INTERPRETED_REGEXP |
1277 __ TailCallRuntime(Runtime::kRegExpExec); | 1244 __ TailCallRuntime(Runtime::kRegExpExec); |
1278 #else // V8_INTERPRETED_REGEXP | 1245 #else // V8_INTERPRETED_REGEXP |
1279 | 1246 |
1280 // Stack frame on entry. | 1247 // Stack frame on entry. |
1281 // sp[0]: last_match_info (expected JSArray) | 1248 // sp[0]: last_match_info (expected JSArray) |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 __ SmiTag(index_); | 1905 __ SmiTag(index_); |
1939 __ Push(object_, index_); | 1906 __ Push(object_, index_); |
1940 __ CallRuntime(Runtime::kStringCharCodeAtRT); | 1907 __ CallRuntime(Runtime::kStringCharCodeAtRT); |
1941 __ Move(result_, r3); | 1908 __ Move(result_, r3); |
1942 call_helper.AfterCall(masm); | 1909 call_helper.AfterCall(masm); |
1943 __ b(&exit_); | 1910 __ b(&exit_); |
1944 | 1911 |
1945 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); | 1912 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); |
1946 } | 1913 } |
1947 | 1914 |
1948 | |
1949 // ------------------------------------------------------------------------- | |
1950 // StringCharFromCodeGenerator | |
1951 | |
1952 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { | |
1953 // Fast case of Heap::LookupSingleCharacterStringFromCode. | |
1954 DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCodeU + 1)); | |
1955 __ LoadSmiLiteral(r0, Smi::FromInt(~String::kMaxOneByteCharCodeU)); | |
1956 __ ori(r0, r0, Operand(kSmiTagMask)); | |
1957 __ and_(r0, code_, r0, SetRC); | |
1958 __ bne(&slow_case_, cr0); | |
1959 | |
1960 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); | |
1961 // At this point code register contains smi tagged one-byte char code. | |
1962 __ mr(r0, code_); | |
1963 __ SmiToPtrArrayOffset(code_, code_); | |
1964 __ add(result_, result_, code_); | |
1965 __ mr(code_, r0); | |
1966 __ LoadP(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); | |
1967 __ CompareRoot(result_, Heap::kUndefinedValueRootIndex); | |
1968 __ beq(&slow_case_); | |
1969 __ bind(&exit_); | |
1970 } | |
1971 | |
1972 | |
1973 void StringCharFromCodeGenerator::GenerateSlow( | |
1974 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { | |
1975 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); | |
1976 | |
1977 __ bind(&slow_case_); | |
1978 call_helper.BeforeCall(masm); | |
1979 __ push(code_); | |
1980 __ CallRuntime(Runtime::kStringCharFromCode); | |
1981 __ Move(result_, r3); | |
1982 call_helper.AfterCall(masm); | |
1983 __ b(&exit_); | |
1984 | |
1985 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | |
1986 } | |
1987 | |
1988 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 1915 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
1989 Register left, | 1916 Register left, |
1990 Register right, | 1917 Register right, |
1991 Register scratch1, | 1918 Register scratch1, |
1992 Register scratch2) { | 1919 Register scratch2) { |
1993 Register length = scratch1; | 1920 Register length = scratch1; |
1994 | 1921 |
1995 // Compare lengths. | 1922 // Compare lengths. |
1996 Label strings_not_equal, check_zero_length; | 1923 Label strings_not_equal, check_zero_length; |
1997 __ LoadP(length, FieldMemOperand(left, String::kLengthOffset)); | 1924 __ LoadP(length, FieldMemOperand(left, String::kLengthOffset)); |
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3618 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 3545 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
3619 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 3546 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
3620 kStackUnwindSpace, NULL, return_value_operand, NULL); | 3547 kStackUnwindSpace, NULL, return_value_operand, NULL); |
3621 } | 3548 } |
3622 | 3549 |
3623 #undef __ | 3550 #undef __ |
3624 } // namespace internal | 3551 } // namespace internal |
3625 } // namespace v8 | 3552 } // namespace v8 |
3626 | 3553 |
3627 #endif // V8_TARGET_ARCH_PPC | 3554 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |