OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 481 |
482 void AllocateHeapNumberStub::GenerateAssembly( | 482 void AllocateHeapNumberStub::GenerateAssembly( |
483 compiler::CodeAssemblerState* state) const { | 483 compiler::CodeAssemblerState* state) const { |
484 typedef compiler::Node Node; | 484 typedef compiler::Node Node; |
485 CodeStubAssembler assembler(state); | 485 CodeStubAssembler assembler(state); |
486 | 486 |
487 Node* result = assembler.AllocateHeapNumber(); | 487 Node* result = assembler.AllocateHeapNumber(); |
488 assembler.Return(result); | 488 assembler.Return(result); |
489 } | 489 } |
490 | 490 |
491 #define SIMD128_GEN_ASM(TYPE, Type, type, lane_count, lane_type) \ | |
492 void Allocate##Type##Stub::GenerateAssembly( \ | |
493 compiler::CodeAssemblerState* state) const { \ | |
494 CodeStubAssembler assembler(state); \ | |
495 compiler::Node* result = \ | |
496 assembler.Allocate(Simd128Value::kSize, CodeStubAssembler::kNone); \ | |
497 compiler::Node* map = assembler.LoadMap(result); \ | |
498 assembler.StoreNoWriteBarrier( \ | |
499 MachineRepresentation::kTagged, map, \ | |
500 assembler.HeapConstant(isolate()->factory()->type##_map())); \ | |
501 assembler.Return(result); \ | |
502 } | |
503 SIMD128_TYPES(SIMD128_GEN_ASM) | |
504 #undef SIMD128_GEN_ASM | |
505 | |
506 void StringLengthStub::GenerateAssembly( | 491 void StringLengthStub::GenerateAssembly( |
507 compiler::CodeAssemblerState* state) const { | 492 compiler::CodeAssemblerState* state) const { |
508 CodeStubAssembler assembler(state); | 493 CodeStubAssembler assembler(state); |
509 compiler::Node* value = assembler.Parameter(0); | 494 compiler::Node* value = assembler.Parameter(0); |
510 compiler::Node* string = assembler.LoadJSValueValue(value); | 495 compiler::Node* string = assembler.LoadJSValueValue(value); |
511 compiler::Node* result = assembler.LoadStringLength(string); | 496 compiler::Node* result = assembler.LoadStringLength(string); |
512 assembler.Return(result); | 497 assembler.Return(result); |
513 } | 498 } |
514 | 499 |
515 #define BINARY_OP_STUB(Name) \ | 500 #define BINARY_OP_STUB(Name) \ |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 } | 1938 } |
1954 | 1939 |
1955 | 1940 |
1956 void AllocateHeapNumberStub::InitializeDescriptor( | 1941 void AllocateHeapNumberStub::InitializeDescriptor( |
1957 CodeStubDescriptor* descriptor) { | 1942 CodeStubDescriptor* descriptor) { |
1958 descriptor->Initialize( | 1943 descriptor->Initialize( |
1959 Runtime::FunctionForId(Runtime::kAllocateHeapNumber)->entry); | 1944 Runtime::FunctionForId(Runtime::kAllocateHeapNumber)->entry); |
1960 } | 1945 } |
1961 | 1946 |
1962 | 1947 |
1963 #define SIMD128_INIT_DESC(TYPE, Type, type, lane_count, lane_type) \ | |
1964 void Allocate##Type##Stub::InitializeDescriptor( \ | |
1965 CodeStubDescriptor* descriptor) { \ | |
1966 descriptor->Initialize( \ | |
1967 Runtime::FunctionForId(Runtime::kCreate##Type)->entry); \ | |
1968 } | |
1969 SIMD128_TYPES(SIMD128_INIT_DESC) | |
1970 #undef SIMD128_INIT_DESC | |
1971 | |
1972 void ToBooleanICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 1948 void ToBooleanICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
1973 descriptor->Initialize(FUNCTION_ADDR(Runtime_ToBooleanIC_Miss)); | 1949 descriptor->Initialize(FUNCTION_ADDR(Runtime_ToBooleanIC_Miss)); |
1974 descriptor->SetMissHandler(Runtime::kToBooleanIC_Miss); | 1950 descriptor->SetMissHandler(Runtime::kToBooleanIC_Miss); |
1975 } | 1951 } |
1976 | 1952 |
1977 | 1953 |
1978 void BinaryOpICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 1954 void BinaryOpICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
1979 descriptor->Initialize(FUNCTION_ADDR(Runtime_BinaryOpIC_Miss)); | 1955 descriptor->Initialize(FUNCTION_ADDR(Runtime_BinaryOpIC_Miss)); |
1980 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss); | 1956 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss); |
1981 } | 1957 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 new_hints |= ToBooleanHint::kString; | 2123 new_hints |= ToBooleanHint::kString; |
2148 to_boolean_value = String::cast(*object)->length() != 0; | 2124 to_boolean_value = String::cast(*object)->length() != 0; |
2149 } else if (object->IsSymbol()) { | 2125 } else if (object->IsSymbol()) { |
2150 new_hints |= ToBooleanHint::kSymbol; | 2126 new_hints |= ToBooleanHint::kSymbol; |
2151 to_boolean_value = true; | 2127 to_boolean_value = true; |
2152 } else if (object->IsHeapNumber()) { | 2128 } else if (object->IsHeapNumber()) { |
2153 DCHECK(!object->IsUndetectable()); | 2129 DCHECK(!object->IsUndetectable()); |
2154 new_hints |= ToBooleanHint::kHeapNumber; | 2130 new_hints |= ToBooleanHint::kHeapNumber; |
2155 double value = HeapNumber::cast(*object)->value(); | 2131 double value = HeapNumber::cast(*object)->value(); |
2156 to_boolean_value = value != 0 && !std::isnan(value); | 2132 to_boolean_value = value != 0 && !std::isnan(value); |
2157 } else if (object->IsSimd128Value()) { | |
2158 new_hints |= ToBooleanHint::kSimdValue; | |
2159 to_boolean_value = true; | |
2160 } else { | 2133 } else { |
2161 // We should never see an internal object at runtime here! | 2134 // We should never see an internal object at runtime here! |
2162 UNREACHABLE(); | 2135 UNREACHABLE(); |
2163 to_boolean_value = true; | 2136 to_boolean_value = true; |
2164 } | 2137 } |
2165 TraceTransition(old_hints, new_hints); | 2138 TraceTransition(old_hints, new_hints); |
2166 set_sub_minor_key(HintsBits::update(sub_minor_key(), new_hints)); | 2139 set_sub_minor_key(HintsBits::update(sub_minor_key(), new_hints)); |
2167 return to_boolean_value; | 2140 return to_boolean_value; |
2168 } | 2141 } |
2169 | 2142 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 } | 2339 } |
2367 | 2340 |
2368 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 2341 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
2369 : PlatformCodeStub(isolate) {} | 2342 : PlatformCodeStub(isolate) {} |
2370 | 2343 |
2371 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) | 2344 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) |
2372 : PlatformCodeStub(isolate) {} | 2345 : PlatformCodeStub(isolate) {} |
2373 | 2346 |
2374 } // namespace internal | 2347 } // namespace internal |
2375 } // namespace v8 | 2348 } // namespace v8 |
OLD | NEW |