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.h" | 7 #include "src/api.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/api-natives.h" | 9 #include "src/api-natives.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
12 #include "src/code-factory.h" | |
13 #include "src/compiler/code-stub-assembler.h" | |
12 #include "src/dateparser-inl.h" | 14 #include "src/dateparser-inl.h" |
13 #include "src/elements.h" | 15 #include "src/elements.h" |
14 #include "src/frames-inl.h" | 16 #include "src/frames-inl.h" |
15 #include "src/gdb-jit.h" | 17 #include "src/gdb-jit.h" |
16 #include "src/ic/handler-compiler.h" | 18 #include "src/ic/handler-compiler.h" |
17 #include "src/ic/ic.h" | 19 #include "src/ic/ic.h" |
18 #include "src/isolate-inl.h" | 20 #include "src/isolate-inl.h" |
19 #include "src/messages.h" | 21 #include "src/messages.h" |
20 #include "src/profiler/cpu-profiler.h" | 22 #include "src/profiler/cpu-profiler.h" |
21 #include "src/property-descriptor.h" | 23 #include "src/property-descriptor.h" |
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2005 HandleScope scope(isolate); | 2007 HandleScope scope(isolate); |
2006 DCHECK_EQ(3, args.length()); | 2008 DCHECK_EQ(3, args.length()); |
2007 Handle<Object> x = args.at<Object>(1); | 2009 Handle<Object> x = args.at<Object>(1); |
2008 Handle<Object> y = args.at<Object>(2); | 2010 Handle<Object> y = args.at<Object>(2); |
2009 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); | 2011 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); |
2010 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, y, Object::ToNumber(y)); | 2012 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, y, Object::ToNumber(y)); |
2011 int product = static_cast<int>(NumberToUint32(*x) * NumberToUint32(*y)); | 2013 int product = static_cast<int>(NumberToUint32(*x) * NumberToUint32(*y)); |
2012 return *isolate->factory()->NewNumberFromInt(product); | 2014 return *isolate->factory()->NewNumberFromInt(product); |
2013 } | 2015 } |
2014 | 2016 |
2017 // ES6 section 20.2.2.32 Math.sqrt ( x ) | |
2018 void Builtins::Generate_MathSqrt(compiler::CodeStubAssembler* assembler) { | |
2019 typedef compiler::CodeStubAssembler::Label Label; | |
2020 typedef compiler::Node Node; | |
2021 typedef compiler::CodeStubAssembler::Variable Variable; | |
2022 | |
2023 Node* context = assembler->Parameter(4); | |
2024 | |
2025 // Shared entry for the floating point sqrt. | |
2026 Label do_fsqrt(assembler); | |
2027 Variable var_fsqrt_x(assembler, MachineRepresentation::kFloat64); | |
2028 | |
2029 // We might need to loop once due to the ToNumber conversion. | |
2030 Variable var_x(assembler, MachineRepresentation::kTagged); | |
2031 Label loop(assembler, &var_x); | |
2032 var_x.Bind(assembler->Parameter(1)); | |
2033 assembler->Goto(&loop); | |
2034 assembler->Bind(&loop); | |
2035 { | |
2036 // Load the current {x} value. | |
2037 Node* x = var_x.value(); | |
2038 | |
2039 // Check if {x} is a Smi or a HeapObject. | |
2040 Label if_xissmi(assembler), if_xisnotsmi(assembler); | |
2041 assembler->Branch(assembler->WordIsSmi(x), &if_xissmi, &if_xisnotsmi); | |
2042 | |
2043 assembler->Bind(&if_xissmi); | |
2044 { | |
2045 // Perform the floating point sqrt. | |
2046 var_fsqrt_x.Bind(assembler->SmiToFloat64(x)); | |
2047 assembler->Goto(&do_fsqrt); | |
2048 } | |
2049 | |
2050 assembler->Bind(&if_xisnotsmi); | |
2051 { | |
2052 // Load the map of {x}. | |
2053 Node* x_map = assembler->LoadMap(x); | |
2054 | |
2055 // Check if {x} is a HeapNumber. | |
2056 Label if_xisnumber(assembler), | |
2057 if_xisnotnumber(assembler, Label::kDeferred); | |
2058 assembler->Branch( | |
2059 assembler->WordEqual(x_map, assembler->HeapNumberMapConstant()), | |
Michael Starzinger
2016/03/22 12:54:31
Note that checking like this will not cover mutabl
Benedikt Meurer
2016/03/22 13:01:18
As discussed offline, this is in line with what we
| |
2060 &if_xisnumber, &if_xisnotnumber); | |
2061 | |
2062 assembler->Bind(&if_xisnumber); | |
2063 { | |
2064 // Perform the floating point sqrt. | |
2065 var_fsqrt_x.Bind(assembler->LoadHeapNumberValue(x)); | |
2066 assembler->Goto(&do_fsqrt); | |
2067 } | |
2068 | |
2069 assembler->Bind(&if_xisnotnumber); | |
2070 { | |
2071 // Convert {x} to a Number first. | |
2072 Callable callable = | |
2073 CodeFactory::NonNumberToNumber(assembler->isolate()); | |
2074 var_x.Bind(assembler->CallStub(callable, context, x)); | |
2075 assembler->Goto(&loop); | |
2076 } | |
2077 } | |
2078 } | |
2079 | |
2080 assembler->Bind(&do_fsqrt); | |
2081 { | |
2082 Node* x = var_fsqrt_x.value(); | |
2083 Node* value = assembler->Float64Sqrt(x); | |
2084 Node* result = assembler->Allocate(HeapNumber::kSize, | |
2085 compiler::CodeStubAssembler::kNone); | |
2086 assembler->StoreMapNoWriteBarrier(result, | |
2087 assembler->HeapNumberMapConstant()); | |
2088 assembler->StoreHeapNumberValue(result, value); | |
2089 assembler->Return(result); | |
2090 } | |
2091 } | |
2015 | 2092 |
2016 // ----------------------------------------------------------------------------- | 2093 // ----------------------------------------------------------------------------- |
2017 // ES6 section 26.1 The Reflect Object | 2094 // ES6 section 26.1 The Reflect Object |
2018 | 2095 |
2019 | 2096 |
2020 // ES6 section 26.1.3 Reflect.defineProperty | 2097 // ES6 section 26.1.3 Reflect.defineProperty |
2021 BUILTIN(ReflectDefineProperty) { | 2098 BUILTIN(ReflectDefineProperty) { |
2022 HandleScope scope(isolate); | 2099 HandleScope scope(isolate); |
2023 DCHECK_EQ(4, args.length()); | 2100 DCHECK_EQ(4, args.length()); |
2024 Handle<Object> target = args.at<Object>(1); | 2101 Handle<Object> target = args.at<Object>(1); |
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4268 | 4345 |
4269 | 4346 |
4270 #define DEF_ENUM_C(name, ignore) FUNCTION_ADDR(Builtin_##name), | 4347 #define DEF_ENUM_C(name, ignore) FUNCTION_ADDR(Builtin_##name), |
4271 Address const Builtins::c_functions_[cfunction_count] = { | 4348 Address const Builtins::c_functions_[cfunction_count] = { |
4272 BUILTIN_LIST_C(DEF_ENUM_C) | 4349 BUILTIN_LIST_C(DEF_ENUM_C) |
4273 }; | 4350 }; |
4274 #undef DEF_ENUM_C | 4351 #undef DEF_ENUM_C |
4275 | 4352 |
4276 | 4353 |
4277 struct BuiltinDesc { | 4354 struct BuiltinDesc { |
4355 Handle<Code> (*builder)(Isolate*, struct BuiltinDesc const*); | |
4278 byte* generator; | 4356 byte* generator; |
4279 byte* c_code; | 4357 byte* c_code; |
4280 const char* s_name; // name is only used for generating log information. | 4358 const char* s_name; // name is only used for generating log information. |
4281 int name; | 4359 int name; |
4282 Code::Flags flags; | 4360 Code::Flags flags; |
4283 BuiltinExtraArguments extra_args; | 4361 BuiltinExtraArguments extra_args; |
4362 int argc; | |
4284 }; | 4363 }; |
4285 | 4364 |
4286 #define BUILTIN_FUNCTION_TABLE_INIT { V8_ONCE_INIT, {} } | 4365 #define BUILTIN_FUNCTION_TABLE_INIT { V8_ONCE_INIT, {} } |
4287 | 4366 |
4288 class BuiltinFunctionTable { | 4367 class BuiltinFunctionTable { |
4289 public: | 4368 public: |
4290 BuiltinDesc* functions() { | 4369 BuiltinDesc* functions() { |
4291 base::CallOnce(&once_, &Builtins::InitBuiltinFunctionTable); | 4370 base::CallOnce(&once_, &Builtins::InitBuiltinFunctionTable); |
4292 return functions_; | 4371 return functions_; |
4293 } | 4372 } |
4294 | 4373 |
4295 base::OnceType once_; | 4374 base::OnceType once_; |
4296 BuiltinDesc functions_[Builtins::builtin_count + 1]; | 4375 BuiltinDesc functions_[Builtins::builtin_count + 1]; |
4297 | 4376 |
4298 friend class Builtins; | 4377 friend class Builtins; |
4299 }; | 4378 }; |
4300 | 4379 |
4301 static BuiltinFunctionTable builtin_function_table = | 4380 namespace { |
4302 BUILTIN_FUNCTION_TABLE_INIT; | 4381 |
4382 BuiltinFunctionTable builtin_function_table = BUILTIN_FUNCTION_TABLE_INIT; | |
4383 | |
4384 Handle<Code> MacroAssemblerBuilder(Isolate* isolate, | |
4385 BuiltinDesc const* builtin_desc) { | |
4386 // For now we generate builtin adaptor code into a stack-allocated | |
4387 // buffer, before copying it into individual code objects. Be careful | |
4388 // with alignment, some platforms don't like unaligned code. | |
4389 #ifdef DEBUG | |
4390 // We can generate a lot of debug code on Arm64. | |
4391 const size_t buffer_size = 32 * KB; | |
4392 #elif V8_TARGET_ARCH_PPC64 | |
4393 // 8 KB is insufficient on PPC64 when FLAG_debug_code is on. | |
4394 const size_t buffer_size = 10 * KB; | |
4395 #else | |
4396 const size_t buffer_size = 8 * KB; | |
4397 #endif | |
4398 union { | |
4399 int force_alignment; | |
4400 byte buffer[buffer_size]; // NOLINT(runtime/arrays) | |
4401 } u; | |
4402 | |
4403 MacroAssembler masm(isolate, u.buffer, sizeof(u.buffer), | |
4404 CodeObjectRequired::kYes); | |
4405 // Generate the code/adaptor. | |
4406 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); | |
4407 Generator g = FUNCTION_CAST<Generator>(builtin_desc->generator); | |
4408 // We pass all arguments to the generator, but it may not use all of | |
4409 // them. This works because the first arguments are on top of the | |
4410 // stack. | |
4411 DCHECK(!masm.has_frame()); | |
4412 g(&masm, builtin_desc->name, builtin_desc->extra_args); | |
4413 // Move the code into the object heap. | |
4414 CodeDesc desc; | |
4415 masm.GetCode(&desc); | |
4416 Code::Flags flags = builtin_desc->flags; | |
4417 return isolate->factory()->NewCode(desc, flags, masm.CodeObject()); | |
4418 } | |
4419 | |
4420 Handle<Code> CodeStubAssemblerBuilder(Isolate* isolate, | |
4421 BuiltinDesc const* builtin_desc) { | |
4422 Zone zone; | |
4423 compiler::CodeStubAssembler assembler(isolate, &zone, builtin_desc->argc, | |
4424 builtin_desc->flags, | |
4425 builtin_desc->s_name); | |
4426 // Generate the code/adaptor. | |
4427 typedef void (*Generator)(compiler::CodeStubAssembler*); | |
4428 Generator g = FUNCTION_CAST<Generator>(builtin_desc->generator); | |
4429 g(&assembler); | |
4430 return assembler.GenerateCode(); | |
4431 } | |
4432 | |
4433 } // namespace | |
4303 | 4434 |
4304 // Define array of pointers to generators and C builtin functions. | 4435 // Define array of pointers to generators and C builtin functions. |
4305 // We do this in a sort of roundabout way so that we can do the initialization | 4436 // We do this in a sort of roundabout way so that we can do the initialization |
4306 // within the lexical scope of Builtins:: and within a context where | 4437 // within the lexical scope of Builtins:: and within a context where |
4307 // Code::Flags names a non-abstract type. | 4438 // Code::Flags names a non-abstract type. |
4308 void Builtins::InitBuiltinFunctionTable() { | 4439 void Builtins::InitBuiltinFunctionTable() { |
4309 BuiltinDesc* functions = builtin_function_table.functions_; | 4440 BuiltinDesc* functions = builtin_function_table.functions_; |
4310 functions[builtin_count].generator = NULL; | 4441 functions[builtin_count].builder = nullptr; |
4311 functions[builtin_count].c_code = NULL; | 4442 functions[builtin_count].generator = nullptr; |
4312 functions[builtin_count].s_name = NULL; | 4443 functions[builtin_count].c_code = nullptr; |
4444 functions[builtin_count].s_name = nullptr; | |
4313 functions[builtin_count].name = builtin_count; | 4445 functions[builtin_count].name = builtin_count; |
4314 functions[builtin_count].flags = static_cast<Code::Flags>(0); | 4446 functions[builtin_count].flags = static_cast<Code::Flags>(0); |
4315 functions[builtin_count].extra_args = BuiltinExtraArguments::kNone; | 4447 functions[builtin_count].extra_args = BuiltinExtraArguments::kNone; |
4448 functions[builtin_count].argc = 0; | |
4316 | 4449 |
4317 #define DEF_FUNCTION_PTR_C(aname, aextra_args) \ | 4450 #define DEF_FUNCTION_PTR_C(aname, aextra_args) \ |
4451 functions->builder = &MacroAssemblerBuilder; \ | |
4318 functions->generator = FUNCTION_ADDR(Generate_Adaptor); \ | 4452 functions->generator = FUNCTION_ADDR(Generate_Adaptor); \ |
4319 functions->c_code = FUNCTION_ADDR(Builtin_##aname); \ | 4453 functions->c_code = FUNCTION_ADDR(Builtin_##aname); \ |
4320 functions->s_name = #aname; \ | 4454 functions->s_name = #aname; \ |
4321 functions->name = c_##aname; \ | 4455 functions->name = c_##aname; \ |
4322 functions->flags = Code::ComputeFlags(Code::BUILTIN); \ | 4456 functions->flags = Code::ComputeFlags(Code::BUILTIN); \ |
4323 functions->extra_args = BuiltinExtraArguments::aextra_args; \ | 4457 functions->extra_args = BuiltinExtraArguments::aextra_args; \ |
4458 functions->argc = 0; \ | |
4324 ++functions; | 4459 ++functions; |
4325 | 4460 |
4326 #define DEF_FUNCTION_PTR_A(aname, kind, state, extra) \ | 4461 #define DEF_FUNCTION_PTR_A(aname, kind, state, extra) \ |
4462 functions->builder = &MacroAssemblerBuilder; \ | |
4327 functions->generator = FUNCTION_ADDR(Generate_##aname); \ | 4463 functions->generator = FUNCTION_ADDR(Generate_##aname); \ |
4328 functions->c_code = NULL; \ | 4464 functions->c_code = NULL; \ |
4329 functions->s_name = #aname; \ | 4465 functions->s_name = #aname; \ |
4330 functions->name = k##aname; \ | 4466 functions->name = k##aname; \ |
4331 functions->flags = Code::ComputeFlags(Code::kind, state, extra); \ | 4467 functions->flags = Code::ComputeFlags(Code::kind, state, extra); \ |
4332 functions->extra_args = BuiltinExtraArguments::kNone; \ | 4468 functions->extra_args = BuiltinExtraArguments::kNone; \ |
4469 functions->argc = 0; \ | |
4470 ++functions; | |
4471 | |
4472 #define DEF_FUNCTION_PTR_T(aname, aargc) \ | |
4473 functions->builder = &CodeStubAssemblerBuilder; \ | |
4474 functions->generator = FUNCTION_ADDR(Generate_##aname); \ | |
4475 functions->c_code = NULL; \ | |
4476 functions->s_name = #aname; \ | |
4477 functions->name = k##aname; \ | |
4478 functions->flags = \ | |
4479 Code::ComputeFlags(Code::BUILTIN, UNINITIALIZED, kNoExtraICState); \ | |
4480 functions->extra_args = BuiltinExtraArguments::kNone; \ | |
4481 functions->argc = aargc; \ | |
4333 ++functions; | 4482 ++functions; |
4334 | 4483 |
4335 #define DEF_FUNCTION_PTR_H(aname, kind) \ | 4484 #define DEF_FUNCTION_PTR_H(aname, kind) \ |
4485 functions->builder = &MacroAssemblerBuilder; \ | |
4336 functions->generator = FUNCTION_ADDR(Generate_##aname); \ | 4486 functions->generator = FUNCTION_ADDR(Generate_##aname); \ |
4337 functions->c_code = NULL; \ | 4487 functions->c_code = NULL; \ |
4338 functions->s_name = #aname; \ | 4488 functions->s_name = #aname; \ |
4339 functions->name = k##aname; \ | 4489 functions->name = k##aname; \ |
4340 functions->flags = Code::ComputeHandlerFlags(Code::kind); \ | 4490 functions->flags = Code::ComputeHandlerFlags(Code::kind); \ |
4341 functions->extra_args = BuiltinExtraArguments::kNone; \ | 4491 functions->extra_args = BuiltinExtraArguments::kNone; \ |
4492 functions->argc = 0; \ | |
4342 ++functions; | 4493 ++functions; |
4343 | 4494 |
4344 BUILTIN_LIST_C(DEF_FUNCTION_PTR_C) | 4495 BUILTIN_LIST_C(DEF_FUNCTION_PTR_C) |
4345 BUILTIN_LIST_A(DEF_FUNCTION_PTR_A) | 4496 BUILTIN_LIST_A(DEF_FUNCTION_PTR_A) |
4497 BUILTIN_LIST_T(DEF_FUNCTION_PTR_T) | |
4346 BUILTIN_LIST_H(DEF_FUNCTION_PTR_H) | 4498 BUILTIN_LIST_H(DEF_FUNCTION_PTR_H) |
4347 BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A) | 4499 BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A) |
4348 | 4500 |
4349 #undef DEF_FUNCTION_PTR_C | 4501 #undef DEF_FUNCTION_PTR_C |
4350 #undef DEF_FUNCTION_PTR_A | 4502 #undef DEF_FUNCTION_PTR_A |
4503 #undef DEF_FUNCTION_PTR_H | |
4504 #undef DEF_FUNCTION_PTR_T | |
4351 } | 4505 } |
4352 | 4506 |
4353 | 4507 |
4354 void Builtins::SetUp(Isolate* isolate, bool create_heap_objects) { | 4508 void Builtins::SetUp(Isolate* isolate, bool create_heap_objects) { |
4355 DCHECK(!initialized_); | 4509 DCHECK(!initialized_); |
4356 | 4510 |
4357 // Create a scope for the handles in the builtins. | 4511 // Create a scope for the handles in the builtins. |
4358 HandleScope scope(isolate); | 4512 HandleScope scope(isolate); |
4359 | 4513 |
4360 const BuiltinDesc* functions = builtin_function_table.functions(); | 4514 const BuiltinDesc* functions = builtin_function_table.functions(); |
4361 | 4515 |
4362 // For now we generate builtin adaptor code into a stack-allocated | |
4363 // buffer, before copying it into individual code objects. Be careful | |
4364 // with alignment, some platforms don't like unaligned code. | |
4365 #ifdef DEBUG | |
4366 // We can generate a lot of debug code on Arm64. | |
4367 const size_t buffer_size = 32*KB; | |
4368 #elif V8_TARGET_ARCH_PPC64 | |
4369 // 8 KB is insufficient on PPC64 when FLAG_debug_code is on. | |
4370 const size_t buffer_size = 10 * KB; | |
4371 #else | |
4372 const size_t buffer_size = 8*KB; | |
4373 #endif | |
4374 union { int force_alignment; byte buffer[buffer_size]; } u; | |
4375 | |
4376 // Traverse the list of builtins and generate an adaptor in a | 4516 // Traverse the list of builtins and generate an adaptor in a |
4377 // separate code object for each one. | 4517 // separate code object for each one. |
4378 for (int i = 0; i < builtin_count; i++) { | 4518 for (int i = 0; i < builtin_count; i++) { |
4379 if (create_heap_objects) { | 4519 if (create_heap_objects) { |
4380 MacroAssembler masm(isolate, u.buffer, sizeof u.buffer, | 4520 Handle<Code> code = (*functions[i].builder)(isolate, functions + i); |
4381 CodeObjectRequired::kYes); | |
4382 // Generate the code/adaptor. | |
4383 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); | |
4384 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); | |
4385 // We pass all arguments to the generator, but it may not use all of | |
4386 // them. This works because the first arguments are on top of the | |
4387 // stack. | |
4388 DCHECK(!masm.has_frame()); | |
4389 g(&masm, functions[i].name, functions[i].extra_args); | |
4390 // Move the code into the object heap. | |
4391 CodeDesc desc; | |
4392 masm.GetCode(&desc); | |
4393 Code::Flags flags = functions[i].flags; | |
4394 Handle<Code> code = | |
4395 isolate->factory()->NewCode(desc, flags, masm.CodeObject()); | |
4396 // Log the event and add the code to the builtins array. | 4521 // Log the event and add the code to the builtins array. |
4397 PROFILE(isolate, | 4522 PROFILE(isolate, |
4398 CodeCreateEvent(Logger::BUILTIN_TAG, AbstractCode::cast(*code), | 4523 CodeCreateEvent(Logger::BUILTIN_TAG, AbstractCode::cast(*code), |
4399 functions[i].s_name)); | 4524 functions[i].s_name)); |
4400 builtins_[i] = *code; | 4525 builtins_[i] = *code; |
4401 code->set_builtin_index(i); | 4526 code->set_builtin_index(i); |
4402 #ifdef ENABLE_DISASSEMBLER | 4527 #ifdef ENABLE_DISASSEMBLER |
4403 if (FLAG_print_builtin_code) { | 4528 if (FLAG_print_builtin_code) { |
4404 CodeTracer::Scope trace_scope(isolate->GetCodeTracer()); | 4529 CodeTracer::Scope trace_scope(isolate->GetCodeTracer()); |
4405 OFStream os(trace_scope.file()); | 4530 OFStream os(trace_scope.file()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4459 Code** code_address = \ | 4584 Code** code_address = \ |
4460 reinterpret_cast<Code**>(builtin_address(k##name)); \ | 4585 reinterpret_cast<Code**>(builtin_address(k##name)); \ |
4461 return Handle<Code>(code_address); \ | 4586 return Handle<Code>(code_address); \ |
4462 } | 4587 } |
4463 #define DEFINE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \ | 4588 #define DEFINE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \ |
4464 Handle<Code> Builtins::name() { \ | 4589 Handle<Code> Builtins::name() { \ |
4465 Code** code_address = \ | 4590 Code** code_address = \ |
4466 reinterpret_cast<Code**>(builtin_address(k##name)); \ | 4591 reinterpret_cast<Code**>(builtin_address(k##name)); \ |
4467 return Handle<Code>(code_address); \ | 4592 return Handle<Code>(code_address); \ |
4468 } | 4593 } |
4594 #define DEFINE_BUILTIN_ACCESSOR_T(name, argc) \ | |
Michael Starzinger
2016/03/22 12:54:31
All four macros seem to do the same. Is there a re
Benedikt Meurer
2016/03/22 13:01:18
Different parameters and for symmetry.
| |
4595 Handle<Code> Builtins::name() { \ | |
4596 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##name)); \ | |
4597 return Handle<Code>(code_address); \ | |
4598 } | |
4469 #define DEFINE_BUILTIN_ACCESSOR_H(name, kind) \ | 4599 #define DEFINE_BUILTIN_ACCESSOR_H(name, kind) \ |
4470 Handle<Code> Builtins::name() { \ | 4600 Handle<Code> Builtins::name() { \ |
4471 Code** code_address = \ | 4601 Code** code_address = \ |
4472 reinterpret_cast<Code**>(builtin_address(k##name)); \ | 4602 reinterpret_cast<Code**>(builtin_address(k##name)); \ |
4473 return Handle<Code>(code_address); \ | 4603 return Handle<Code>(code_address); \ |
4474 } | 4604 } |
4475 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4605 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4476 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4606 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4607 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) | |
4477 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4608 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4478 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4609 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4479 #undef DEFINE_BUILTIN_ACCESSOR_C | 4610 #undef DEFINE_BUILTIN_ACCESSOR_C |
4480 #undef DEFINE_BUILTIN_ACCESSOR_A | 4611 #undef DEFINE_BUILTIN_ACCESSOR_A |
4481 | 4612 #undef DEFINE_BUILTIN_ACCESSOR_T |
4613 #undef DEFINE_BUILTIN_ACCESSOR_H | |
4482 | 4614 |
4483 } // namespace internal | 4615 } // namespace internal |
4484 } // namespace v8 | 4616 } // namespace v8 |
OLD | NEW |