OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stub-assembler.h" | 9 #include "src/code-stub-assembler.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 if (std::isnan(value)) { | 26 if (std::isnan(value)) { |
27 *out = 0; | 27 *out = 0; |
28 } else if (value > kMaxInt) { | 28 } else if (value > kMaxInt) { |
29 *out = kMaxInt; | 29 *out = kMaxInt; |
30 } else if (value < kMinInt) { | 30 } else if (value < kMinInt) { |
31 *out = kMinInt; | 31 *out = kMinInt; |
32 } else { | 32 } else { |
33 *out = static_cast<int>(value); | 33 *out = static_cast<int>(value); |
34 } | 34 } |
35 return true; | 35 return true; |
36 } else if (object->IsUndefined(isolate) || object->IsNull(isolate)) { | 36 } else if (object->IsNullOrUndefined(isolate)) { |
37 *out = 0; | 37 *out = 0; |
38 return true; | 38 return true; |
39 } else if (object->IsBoolean()) { | 39 } else if (object->IsBoolean()) { |
40 *out = object->IsTrue(isolate); | 40 *out = object->IsTrue(isolate); |
41 return true; | 41 return true; |
42 } | 42 } |
43 return false; | 43 return false; |
44 } | 44 } |
45 | 45 |
46 inline bool GetSloppyArgumentsLength(Isolate* isolate, Handle<JSObject> object, | 46 inline bool GetSloppyArgumentsLength(Isolate* isolate, Handle<JSObject> object, |
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 } | 1336 } |
1337 | 1337 |
1338 } // namespace | 1338 } // namespace |
1339 | 1339 |
1340 // ES6 22.1.3.1 Array.prototype.concat | 1340 // ES6 22.1.3.1 Array.prototype.concat |
1341 BUILTIN(ArrayConcat) { | 1341 BUILTIN(ArrayConcat) { |
1342 HandleScope scope(isolate); | 1342 HandleScope scope(isolate); |
1343 | 1343 |
1344 Handle<Object> receiver = args.receiver(); | 1344 Handle<Object> receiver = args.receiver(); |
1345 // TODO(bmeurer): Do we really care about the exact exception message here? | 1345 // TODO(bmeurer): Do we really care about the exact exception message here? |
1346 if (receiver->IsNull(isolate) || receiver->IsUndefined(isolate)) { | 1346 if (receiver->IsNullOrUndefined(isolate)) { |
1347 THROW_NEW_ERROR_RETURN_FAILURE( | 1347 THROW_NEW_ERROR_RETURN_FAILURE( |
1348 isolate, NewTypeError(MessageTemplate::kCalledOnNullOrUndefined, | 1348 isolate, NewTypeError(MessageTemplate::kCalledOnNullOrUndefined, |
1349 isolate->factory()->NewStringFromAsciiChecked( | 1349 isolate->factory()->NewStringFromAsciiChecked( |
1350 "Array.prototype.concat"))); | 1350 "Array.prototype.concat"))); |
1351 } | 1351 } |
1352 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1352 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1353 isolate, receiver, Object::ToObject(isolate, args.receiver())); | 1353 isolate, receiver, Object::ToObject(isolate, args.receiver())); |
1354 args[0] = *receiver; | 1354 args[0] = *receiver; |
1355 | 1355 |
1356 Handle<JSArray> result_array; | 1356 Handle<JSArray> result_array; |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation); | 2746 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation); |
2747 Node* result = | 2747 Node* result = |
2748 assembler.CallRuntime(Runtime::kThrowTypeError, context, message, | 2748 assembler.CallRuntime(Runtime::kThrowTypeError, context, message, |
2749 assembler.HeapConstant(operation)); | 2749 assembler.HeapConstant(operation)); |
2750 assembler.Return(result); | 2750 assembler.Return(result); |
2751 } | 2751 } |
2752 } | 2752 } |
2753 | 2753 |
2754 } // namespace internal | 2754 } // namespace internal |
2755 } // namespace v8 | 2755 } // namespace v8 |
OLD | NEW |