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 #include "src/base/flags.h" | 5 #include "src/base/flags.h" |
6 #include "src/bootstrapper.h" | 6 #include "src/bootstrapper.h" |
7 #include "src/compiler/graph-reducer.h" | 7 #include "src/compiler/graph-reducer.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2403 return typer_->cache_->Get(kUint32ArrayFunc); | 2403 return typer_->cache_->Get(kUint32ArrayFunc); |
2404 } else if (*value == native->float32_array_fun()) { | 2404 } else if (*value == native->float32_array_fun()) { |
2405 return typer_->cache_->Get(kFloat32ArrayFunc); | 2405 return typer_->cache_->Get(kFloat32ArrayFunc); |
2406 } else if (*value == native->float64_array_fun()) { | 2406 } else if (*value == native->float64_array_fun()) { |
2407 return typer_->cache_->Get(kFloat64ArrayFunc); | 2407 return typer_->cache_->Get(kFloat64ArrayFunc); |
2408 } | 2408 } |
2409 } | 2409 } |
2410 int const arity = | 2410 int const arity = |
2411 JSFunction::cast(*value)->shared()->internal_formal_parameter_count(); | 2411 JSFunction::cast(*value)->shared()->internal_formal_parameter_count(); |
2412 switch (arity) { | 2412 switch (arity) { |
| 2413 case SharedFunctionInfo::kDontAdaptArgumentsSentinel: |
| 2414 // Some smart optimization at work... &%$!&@+$! |
| 2415 return Type::Any(zone()); |
2413 case 0: | 2416 case 0: |
2414 return typer_->cache_->Get(kAnyFunc0); | 2417 return typer_->cache_->Get(kAnyFunc0); |
2415 case 1: | 2418 case 1: |
2416 return typer_->cache_->Get(kAnyFunc1); | 2419 return typer_->cache_->Get(kAnyFunc1); |
2417 case 2: | 2420 case 2: |
2418 return typer_->cache_->Get(kAnyFunc2); | 2421 return typer_->cache_->Get(kAnyFunc2); |
2419 case 3: | 2422 case 3: |
2420 return typer_->cache_->Get(kAnyFunc3); | 2423 return typer_->cache_->Get(kAnyFunc3); |
2421 default: { | 2424 default: { |
| 2425 DCHECK_LT(3, arity); |
2422 Type** const params = zone()->NewArray<Type*>(arity); | 2426 Type** const params = zone()->NewArray<Type*>(arity); |
2423 std::fill(¶ms[0], ¶ms[arity], Type::Any(zone())); | 2427 std::fill(¶ms[0], ¶ms[arity], Type::Any(zone())); |
2424 return Type::Function(Type::Any(zone()), arity, params, zone()); | 2428 return Type::Function(Type::Any(zone()), arity, params, zone()); |
2425 } | 2429 } |
2426 } | 2430 } |
2427 } else if (value->IsJSTypedArray()) { | 2431 } else if (value->IsJSTypedArray()) { |
2428 switch (JSTypedArray::cast(*value)->type()) { | 2432 switch (JSTypedArray::cast(*value)->type()) { |
2429 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 2433 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
2430 case kExternal##Type##Array: \ | 2434 case kExternal##Type##Array: \ |
2431 return typer_->cache_->Get(k##Type##Array); | 2435 return typer_->cache_->Get(k##Type##Array); |
2432 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2436 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
2433 #undef TYPED_ARRAY_CASE | 2437 #undef TYPED_ARRAY_CASE |
2434 } | 2438 } |
2435 } | 2439 } |
2436 return Type::Constant(value, zone()); | 2440 return Type::Constant(value, zone()); |
2437 } | 2441 } |
2438 | 2442 |
2439 } // namespace compiler | 2443 } // namespace compiler |
2440 } // namespace internal | 2444 } // namespace internal |
2441 } // namespace v8 | 2445 } // namespace v8 |
OLD | NEW |