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 |
491 void StringLengthStub::GenerateAssembly( | 506 void StringLengthStub::GenerateAssembly( |
492 compiler::CodeAssemblerState* state) const { | 507 compiler::CodeAssemblerState* state) const { |
493 CodeStubAssembler assembler(state); | 508 CodeStubAssembler assembler(state); |
494 compiler::Node* value = assembler.Parameter(0); | 509 compiler::Node* value = assembler.Parameter(0); |
495 compiler::Node* string = assembler.LoadJSValueValue(value); | 510 compiler::Node* string = assembler.LoadJSValueValue(value); |
496 compiler::Node* result = assembler.LoadStringLength(string); | 511 compiler::Node* result = assembler.LoadStringLength(string); |
497 assembler.Return(result); | 512 assembler.Return(result); |
498 } | 513 } |
499 | 514 |
500 #define BINARY_OP_STUB(Name) \ | 515 #define BINARY_OP_STUB(Name) \ |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 } | 1953 } |
1939 | 1954 |
1940 | 1955 |
1941 void AllocateHeapNumberStub::InitializeDescriptor( | 1956 void AllocateHeapNumberStub::InitializeDescriptor( |
1942 CodeStubDescriptor* descriptor) { | 1957 CodeStubDescriptor* descriptor) { |
1943 descriptor->Initialize( | 1958 descriptor->Initialize( |
1944 Runtime::FunctionForId(Runtime::kAllocateHeapNumber)->entry); | 1959 Runtime::FunctionForId(Runtime::kAllocateHeapNumber)->entry); |
1945 } | 1960 } |
1946 | 1961 |
1947 | 1962 |
| 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 |
1948 void ToBooleanICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 1972 void ToBooleanICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
1949 descriptor->Initialize(FUNCTION_ADDR(Runtime_ToBooleanIC_Miss)); | 1973 descriptor->Initialize(FUNCTION_ADDR(Runtime_ToBooleanIC_Miss)); |
1950 descriptor->SetMissHandler(Runtime::kToBooleanIC_Miss); | 1974 descriptor->SetMissHandler(Runtime::kToBooleanIC_Miss); |
1951 } | 1975 } |
1952 | 1976 |
1953 | 1977 |
1954 void BinaryOpICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 1978 void BinaryOpICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
1955 descriptor->Initialize(FUNCTION_ADDR(Runtime_BinaryOpIC_Miss)); | 1979 descriptor->Initialize(FUNCTION_ADDR(Runtime_BinaryOpIC_Miss)); |
1956 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss); | 1980 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss); |
1957 } | 1981 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 new_hints |= ToBooleanHint::kString; | 2147 new_hints |= ToBooleanHint::kString; |
2124 to_boolean_value = String::cast(*object)->length() != 0; | 2148 to_boolean_value = String::cast(*object)->length() != 0; |
2125 } else if (object->IsSymbol()) { | 2149 } else if (object->IsSymbol()) { |
2126 new_hints |= ToBooleanHint::kSymbol; | 2150 new_hints |= ToBooleanHint::kSymbol; |
2127 to_boolean_value = true; | 2151 to_boolean_value = true; |
2128 } else if (object->IsHeapNumber()) { | 2152 } else if (object->IsHeapNumber()) { |
2129 DCHECK(!object->IsUndetectable()); | 2153 DCHECK(!object->IsUndetectable()); |
2130 new_hints |= ToBooleanHint::kHeapNumber; | 2154 new_hints |= ToBooleanHint::kHeapNumber; |
2131 double value = HeapNumber::cast(*object)->value(); | 2155 double value = HeapNumber::cast(*object)->value(); |
2132 to_boolean_value = value != 0 && !std::isnan(value); | 2156 to_boolean_value = value != 0 && !std::isnan(value); |
| 2157 } else if (object->IsSimd128Value()) { |
| 2158 new_hints |= ToBooleanHint::kSimdValue; |
| 2159 to_boolean_value = true; |
2133 } else { | 2160 } else { |
2134 // We should never see an internal object at runtime here! | 2161 // We should never see an internal object at runtime here! |
2135 UNREACHABLE(); | 2162 UNREACHABLE(); |
2136 to_boolean_value = true; | 2163 to_boolean_value = true; |
2137 } | 2164 } |
2138 TraceTransition(old_hints, new_hints); | 2165 TraceTransition(old_hints, new_hints); |
2139 set_sub_minor_key(HintsBits::update(sub_minor_key(), new_hints)); | 2166 set_sub_minor_key(HintsBits::update(sub_minor_key(), new_hints)); |
2140 return to_boolean_value; | 2167 return to_boolean_value; |
2141 } | 2168 } |
2142 | 2169 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2339 } | 2366 } |
2340 | 2367 |
2341 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 2368 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
2342 : PlatformCodeStub(isolate) {} | 2369 : PlatformCodeStub(isolate) {} |
2343 | 2370 |
2344 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) | 2371 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) |
2345 : PlatformCodeStub(isolate) {} | 2372 : PlatformCodeStub(isolate) {} |
2346 | 2373 |
2347 } // namespace internal | 2374 } // namespace internal |
2348 } // namespace v8 | 2375 } // namespace v8 |
OLD | NEW |