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/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api-arguments.h" | 7 #include "src/api-arguments.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 Node* result = assembler->ChangeFloat64ToTagged(value); | 2387 Node* result = assembler->ChangeFloat64ToTagged(value); |
2388 assembler->Return(result); | 2388 assembler->Return(result); |
2389 } | 2389 } |
2390 | 2390 |
2391 // ES6 section 20.2.2.35 Math.trunc ( x ) | 2391 // ES6 section 20.2.2.35 Math.trunc ( x ) |
2392 void Builtins::Generate_MathTrunc(CodeStubAssembler* assembler) { | 2392 void Builtins::Generate_MathTrunc(CodeStubAssembler* assembler) { |
2393 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Trunc); | 2393 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Trunc); |
2394 } | 2394 } |
2395 | 2395 |
2396 // ----------------------------------------------------------------------------- | 2396 // ----------------------------------------------------------------------------- |
| 2397 // ES6 section 19.2 Function Objects |
| 2398 |
| 2399 // ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] ( V ) |
| 2400 void Builtins::Generate_FunctionPrototypeHasInstance( |
| 2401 CodeStubAssembler* assembler) { |
| 2402 using compiler::Node; |
| 2403 |
| 2404 Node* f = assembler->Parameter(0); |
| 2405 Node* v = assembler->Parameter(1); |
| 2406 Node* context = assembler->Parameter(4); |
| 2407 Node* result = assembler->OrdinaryHasInstance(context, f, v); |
| 2408 assembler->Return(result); |
| 2409 } |
| 2410 |
| 2411 // ----------------------------------------------------------------------------- |
2397 // ES6 section 25.3 Generator Objects | 2412 // ES6 section 25.3 Generator Objects |
2398 | 2413 |
2399 namespace { | 2414 namespace { |
2400 | 2415 |
2401 void Generate_GeneratorPrototypeResume( | 2416 void Generate_GeneratorPrototypeResume( |
2402 CodeStubAssembler* assembler, JSGeneratorObject::ResumeMode resume_mode, | 2417 CodeStubAssembler* assembler, JSGeneratorObject::ResumeMode resume_mode, |
2403 char const* const method_name) { | 2418 char const* const method_name) { |
2404 typedef CodeStubAssembler::Label Label; | 2419 typedef CodeStubAssembler::Label Label; |
2405 typedef compiler::Node Node; | 2420 typedef compiler::Node Node; |
2406 | 2421 |
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4190 } | 4205 } |
4191 LookupIterator it(function, isolate->factory()->name_string()); | 4206 LookupIterator it(function, isolate->factory()->name_string()); |
4192 DCHECK_EQ(LookupIterator::ACCESSOR, it.state()); | 4207 DCHECK_EQ(LookupIterator::ACCESSOR, it.state()); |
4193 RETURN_FAILURE_ON_EXCEPTION(isolate, | 4208 RETURN_FAILURE_ON_EXCEPTION(isolate, |
4194 JSObject::DefineOwnPropertyIgnoreAttributes( | 4209 JSObject::DefineOwnPropertyIgnoreAttributes( |
4195 &it, name, it.property_attributes())); | 4210 &it, name, it.property_attributes())); |
4196 } | 4211 } |
4197 return *function; | 4212 return *function; |
4198 } | 4213 } |
4199 | 4214 |
4200 | |
4201 // ES6 section 19.2.3.5 Function.prototype.toString ( ) | 4215 // ES6 section 19.2.3.5 Function.prototype.toString ( ) |
4202 BUILTIN(FunctionPrototypeToString) { | 4216 BUILTIN(FunctionPrototypeToString) { |
4203 HandleScope scope(isolate); | 4217 HandleScope scope(isolate); |
4204 Handle<Object> receiver = args.receiver(); | 4218 Handle<Object> receiver = args.receiver(); |
4205 if (receiver->IsJSBoundFunction()) { | 4219 if (receiver->IsJSBoundFunction()) { |
4206 return *JSBoundFunction::ToString(Handle<JSBoundFunction>::cast(receiver)); | 4220 return *JSBoundFunction::ToString(Handle<JSBoundFunction>::cast(receiver)); |
4207 } else if (receiver->IsJSFunction()) { | 4221 } else if (receiver->IsJSFunction()) { |
4208 return *JSFunction::ToString(Handle<JSFunction>::cast(receiver)); | 4222 return *JSFunction::ToString(Handle<JSFunction>::cast(receiver)); |
4209 } | 4223 } |
4210 THROW_NEW_ERROR_RETURN_FAILURE( | 4224 THROW_NEW_ERROR_RETURN_FAILURE( |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5485 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) | 5499 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) |
5486 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 5500 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
5487 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 5501 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
5488 #undef DEFINE_BUILTIN_ACCESSOR_C | 5502 #undef DEFINE_BUILTIN_ACCESSOR_C |
5489 #undef DEFINE_BUILTIN_ACCESSOR_A | 5503 #undef DEFINE_BUILTIN_ACCESSOR_A |
5490 #undef DEFINE_BUILTIN_ACCESSOR_T | 5504 #undef DEFINE_BUILTIN_ACCESSOR_T |
5491 #undef DEFINE_BUILTIN_ACCESSOR_H | 5505 #undef DEFINE_BUILTIN_ACCESSOR_H |
5492 | 5506 |
5493 } // namespace internal | 5507 } // namespace internal |
5494 } // namespace v8 | 5508 } // namespace v8 |
OLD | NEW |