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/builtins.h" | 5 #include "src/builtins/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/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 6211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6222 BUILTIN(HandleApiCallAsFunction) { | 6222 BUILTIN(HandleApiCallAsFunction) { |
6223 return HandleApiCallAsFunctionOrConstructor(isolate, false, args); | 6223 return HandleApiCallAsFunctionOrConstructor(isolate, false, args); |
6224 } | 6224 } |
6225 | 6225 |
6226 // Handle calls to non-function objects created through the API. This delegate | 6226 // Handle calls to non-function objects created through the API. This delegate |
6227 // function is used when the call is a construct call. | 6227 // function is used when the call is a construct call. |
6228 BUILTIN(HandleApiCallAsConstructor) { | 6228 BUILTIN(HandleApiCallAsConstructor) { |
6229 return HandleApiCallAsFunctionOrConstructor(isolate, true, args); | 6229 return HandleApiCallAsFunctionOrConstructor(isolate, true, args); |
6230 } | 6230 } |
6231 | 6231 |
6232 namespace { | 6232 void Builtins::Generate_LoadIC_Miss(CodeStubAssembler* assembler) { |
6233 | |
6234 void Generate_LoadIC_Miss(CodeStubAssembler* assembler) { | |
6235 typedef compiler::Node Node; | 6233 typedef compiler::Node Node; |
6236 | 6234 |
6237 Node* receiver = assembler->Parameter(0); | 6235 Node* receiver = assembler->Parameter(0); |
6238 Node* name = assembler->Parameter(1); | 6236 Node* name = assembler->Parameter(1); |
6239 Node* slot = assembler->Parameter(2); | 6237 Node* slot = assembler->Parameter(2); |
6240 Node* vector = assembler->Parameter(3); | 6238 Node* vector = assembler->Parameter(3); |
6241 Node* context = assembler->Parameter(4); | 6239 Node* context = assembler->Parameter(4); |
6242 | 6240 |
6243 assembler->TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, | 6241 assembler->TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, |
6244 slot, vector); | 6242 slot, vector); |
6245 } | 6243 } |
6246 | 6244 |
6247 void Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) { | 6245 void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) { |
6248 typedef compiler::Node Node; | 6246 typedef compiler::Node Node; |
6249 | 6247 |
6250 Node* slot = assembler->Parameter(0); | 6248 Node* slot = assembler->Parameter(0); |
6251 Node* vector = assembler->Parameter(1); | 6249 Node* vector = assembler->Parameter(1); |
6252 Node* context = assembler->Parameter(2); | 6250 Node* context = assembler->Parameter(2); |
6253 | 6251 |
6254 assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot, | 6252 assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot, |
6255 vector); | 6253 vector); |
6256 } | 6254 } |
6257 | 6255 |
6258 void Generate_LoadIC_Normal(MacroAssembler* masm) { | 6256 void Builtins::Generate_LoadIC_Normal(MacroAssembler* masm) { |
6259 LoadIC::GenerateNormal(masm); | 6257 LoadIC::GenerateNormal(masm); |
6260 } | 6258 } |
6261 | 6259 |
6262 void Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { | 6260 void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { |
6263 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); | 6261 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); |
6264 } | 6262 } |
6265 | 6263 |
6266 void Generate_LoadIC_Slow(CodeStubAssembler* assembler) { | 6264 void Builtins::Generate_LoadIC_Slow(CodeStubAssembler* assembler) { |
6267 typedef compiler::Node Node; | 6265 typedef compiler::Node Node; |
6268 | 6266 |
6269 Node* receiver = assembler->Parameter(0); | 6267 Node* receiver = assembler->Parameter(0); |
6270 Node* name = assembler->Parameter(1); | 6268 Node* name = assembler->Parameter(1); |
6271 // Node* slot = assembler->Parameter(2); | 6269 // Node* slot = assembler->Parameter(2); |
6272 // Node* vector = assembler->Parameter(3); | 6270 // Node* vector = assembler->Parameter(3); |
6273 Node* context = assembler->Parameter(4); | 6271 Node* context = assembler->Parameter(4); |
6274 | 6272 |
6275 assembler->TailCallRuntime(Runtime::kGetProperty, context, receiver, name); | 6273 assembler->TailCallRuntime(Runtime::kGetProperty, context, receiver, name); |
6276 } | 6274 } |
6277 | 6275 |
| 6276 namespace { |
6278 void Generate_LoadGlobalIC_Slow(CodeStubAssembler* assembler, TypeofMode mode) { | 6277 void Generate_LoadGlobalIC_Slow(CodeStubAssembler* assembler, TypeofMode mode) { |
6279 typedef compiler::Node Node; | 6278 typedef compiler::Node Node; |
6280 | 6279 |
6281 Node* slot = assembler->Parameter(0); | 6280 Node* slot = assembler->Parameter(0); |
6282 Node* vector = assembler->Parameter(1); | 6281 Node* vector = assembler->Parameter(1); |
6283 Node* context = assembler->Parameter(2); | 6282 Node* context = assembler->Parameter(2); |
6284 Node* typeof_mode = assembler->SmiConstant(Smi::FromInt(mode)); | 6283 Node* typeof_mode = assembler->SmiConstant(Smi::FromInt(mode)); |
6285 | 6284 |
6286 assembler->TailCallRuntime(Runtime::kGetGlobal, context, slot, vector, | 6285 assembler->TailCallRuntime(Runtime::kGetGlobal, context, slot, vector, |
6287 typeof_mode); | 6286 typeof_mode); |
6288 } | 6287 } |
| 6288 } // anonymous namespace |
6289 | 6289 |
6290 void Generate_LoadGlobalIC_SlowInsideTypeof(CodeStubAssembler* assembler) { | 6290 void Builtins::Generate_LoadGlobalIC_SlowInsideTypeof( |
| 6291 CodeStubAssembler* assembler) { |
6291 Generate_LoadGlobalIC_Slow(assembler, INSIDE_TYPEOF); | 6292 Generate_LoadGlobalIC_Slow(assembler, INSIDE_TYPEOF); |
6292 } | 6293 } |
6293 | 6294 |
6294 void Generate_LoadGlobalIC_SlowNotInsideTypeof(CodeStubAssembler* assembler) { | 6295 void Builtins::Generate_LoadGlobalIC_SlowNotInsideTypeof( |
| 6296 CodeStubAssembler* assembler) { |
6295 Generate_LoadGlobalIC_Slow(assembler, NOT_INSIDE_TYPEOF); | 6297 Generate_LoadGlobalIC_Slow(assembler, NOT_INSIDE_TYPEOF); |
6296 } | 6298 } |
6297 | 6299 |
6298 void Generate_KeyedLoadIC_Slow(MacroAssembler* masm) { | 6300 void Builtins::Generate_KeyedLoadIC_Slow(MacroAssembler* masm) { |
6299 KeyedLoadIC::GenerateRuntimeGetProperty(masm); | 6301 KeyedLoadIC::GenerateRuntimeGetProperty(masm); |
6300 } | 6302 } |
6301 | 6303 |
6302 void Generate_KeyedLoadIC_Miss(MacroAssembler* masm) { | 6304 void Builtins::Generate_KeyedLoadIC_Miss(MacroAssembler* masm) { |
6303 KeyedLoadIC::GenerateMiss(masm); | 6305 KeyedLoadIC::GenerateMiss(masm); |
6304 } | 6306 } |
6305 | 6307 |
6306 void Generate_KeyedLoadIC_Megamorphic(MacroAssembler* masm) { | 6308 void Builtins::Generate_KeyedLoadIC_Megamorphic(MacroAssembler* masm) { |
6307 KeyedLoadIC::GenerateMegamorphic(masm); | 6309 KeyedLoadIC::GenerateMegamorphic(masm); |
6308 } | 6310 } |
6309 | 6311 |
6310 void Generate_StoreIC_Miss(CodeStubAssembler* assembler) { | 6312 void Builtins::Generate_StoreIC_Miss(CodeStubAssembler* assembler) { |
6311 typedef compiler::Node Node; | 6313 typedef compiler::Node Node; |
6312 | 6314 |
6313 Node* receiver = assembler->Parameter(0); | 6315 Node* receiver = assembler->Parameter(0); |
6314 Node* name = assembler->Parameter(1); | 6316 Node* name = assembler->Parameter(1); |
6315 Node* value = assembler->Parameter(2); | 6317 Node* value = assembler->Parameter(2); |
6316 Node* slot = assembler->Parameter(3); | 6318 Node* slot = assembler->Parameter(3); |
6317 Node* vector = assembler->Parameter(4); | 6319 Node* vector = assembler->Parameter(4); |
6318 Node* context = assembler->Parameter(5); | 6320 Node* context = assembler->Parameter(5); |
6319 | 6321 |
6320 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, name, | 6322 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, name, |
6321 value, slot, vector); | 6323 value, slot, vector); |
6322 } | 6324 } |
6323 | 6325 |
6324 void Generate_StoreIC_Normal(MacroAssembler* masm) { | 6326 void Builtins::Generate_StoreIC_Normal(MacroAssembler* masm) { |
6325 StoreIC::GenerateNormal(masm); | 6327 StoreIC::GenerateNormal(masm); |
6326 } | 6328 } |
6327 | 6329 |
| 6330 namespace { |
6328 void Generate_StoreIC_Slow(CodeStubAssembler* assembler, | 6331 void Generate_StoreIC_Slow(CodeStubAssembler* assembler, |
6329 LanguageMode language_mode) { | 6332 LanguageMode language_mode) { |
6330 typedef compiler::Node Node; | 6333 typedef compiler::Node Node; |
6331 | 6334 |
6332 Node* receiver = assembler->Parameter(0); | 6335 Node* receiver = assembler->Parameter(0); |
6333 Node* name = assembler->Parameter(1); | 6336 Node* name = assembler->Parameter(1); |
6334 Node* value = assembler->Parameter(2); | 6337 Node* value = assembler->Parameter(2); |
6335 // Node* slot = assembler->Parameter(3); | 6338 // Node* slot = assembler->Parameter(3); |
6336 // Node* vector = assembler->Parameter(4); | 6339 // Node* vector = assembler->Parameter(4); |
6337 Node* context = assembler->Parameter(5); | 6340 Node* context = assembler->Parameter(5); |
6338 Node* lang_mode = assembler->SmiConstant(Smi::FromInt(language_mode)); | 6341 Node* lang_mode = assembler->SmiConstant(Smi::FromInt(language_mode)); |
6339 | 6342 |
6340 // The slow case calls into the runtime to complete the store without causing | 6343 // The slow case calls into the runtime to complete the store without causing |
6341 // an IC miss that would otherwise cause a transition to the generic stub. | 6344 // an IC miss that would otherwise cause a transition to the generic stub. |
6342 assembler->TailCallRuntime(Runtime::kSetProperty, context, receiver, name, | 6345 assembler->TailCallRuntime(Runtime::kSetProperty, context, receiver, name, |
6343 value, lang_mode); | 6346 value, lang_mode); |
6344 } | 6347 } |
| 6348 } // anonymous namespace |
6345 | 6349 |
6346 void Generate_StoreIC_SlowSloppy(CodeStubAssembler* assembler) { | 6350 void Builtins::Generate_StoreIC_SlowSloppy(CodeStubAssembler* assembler) { |
6347 Generate_StoreIC_Slow(assembler, SLOPPY); | 6351 Generate_StoreIC_Slow(assembler, SLOPPY); |
6348 } | 6352 } |
6349 | 6353 |
6350 void Generate_StoreIC_SlowStrict(CodeStubAssembler* assembler) { | 6354 void Builtins::Generate_StoreIC_SlowStrict(CodeStubAssembler* assembler) { |
6351 Generate_StoreIC_Slow(assembler, STRICT); | 6355 Generate_StoreIC_Slow(assembler, STRICT); |
6352 } | 6356 } |
6353 | 6357 |
| 6358 namespace { |
6354 // 7.1.1.1 OrdinaryToPrimitive ( O, hint ) | 6359 // 7.1.1.1 OrdinaryToPrimitive ( O, hint ) |
6355 void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler, | 6360 void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler, |
6356 OrdinaryToPrimitiveHint hint) { | 6361 OrdinaryToPrimitiveHint hint) { |
6357 typedef CodeStubAssembler::Label Label; | 6362 typedef CodeStubAssembler::Label Label; |
6358 typedef compiler::Node Node; | 6363 typedef compiler::Node Node; |
6359 typedef CodeStubAssembler::Variable Variable; | 6364 typedef CodeStubAssembler::Variable Variable; |
6360 | 6365 |
6361 Node* input = assembler->Parameter(0); | 6366 Node* input = assembler->Parameter(0); |
6362 Node* context = assembler->Parameter(1); | 6367 Node* context = assembler->Parameter(1); |
6363 | 6368 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6414 // Just continue with the next {name} if the {method} is not callable. | 6419 // Just continue with the next {name} if the {method} is not callable. |
6415 assembler->Goto(&if_methodisnotcallable); | 6420 assembler->Goto(&if_methodisnotcallable); |
6416 assembler->Bind(&if_methodisnotcallable); | 6421 assembler->Bind(&if_methodisnotcallable); |
6417 } | 6422 } |
6418 | 6423 |
6419 assembler->TailCallRuntime(Runtime::kThrowCannotConvertToPrimitive, context); | 6424 assembler->TailCallRuntime(Runtime::kThrowCannotConvertToPrimitive, context); |
6420 | 6425 |
6421 assembler->Bind(&return_result); | 6426 assembler->Bind(&return_result); |
6422 assembler->Return(var_result.value()); | 6427 assembler->Return(var_result.value()); |
6423 } | 6428 } |
| 6429 } // anonymous namespace |
6424 | 6430 |
6425 void Generate_OrdinaryToPrimitive_Number(CodeStubAssembler* assembler) { | 6431 void Builtins::Generate_OrdinaryToPrimitive_Number( |
| 6432 CodeStubAssembler* assembler) { |
6426 Generate_OrdinaryToPrimitive(assembler, OrdinaryToPrimitiveHint::kNumber); | 6433 Generate_OrdinaryToPrimitive(assembler, OrdinaryToPrimitiveHint::kNumber); |
6427 } | 6434 } |
6428 | 6435 |
6429 void Generate_OrdinaryToPrimitive_String(CodeStubAssembler* assembler) { | 6436 void Builtins::Generate_OrdinaryToPrimitive_String( |
| 6437 CodeStubAssembler* assembler) { |
6430 Generate_OrdinaryToPrimitive(assembler, OrdinaryToPrimitiveHint::kString); | 6438 Generate_OrdinaryToPrimitive(assembler, OrdinaryToPrimitiveHint::kString); |
6431 } | 6439 } |
6432 | 6440 |
| 6441 namespace { |
6433 // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] ) | 6442 // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] ) |
6434 void Generate_NonPrimitiveToPrimitive(CodeStubAssembler* assembler, | 6443 void Generate_NonPrimitiveToPrimitive(CodeStubAssembler* assembler, |
6435 ToPrimitiveHint hint) { | 6444 ToPrimitiveHint hint) { |
6436 typedef CodeStubAssembler::Label Label; | 6445 typedef CodeStubAssembler::Label Label; |
6437 typedef compiler::Node Node; | 6446 typedef compiler::Node Node; |
6438 | 6447 |
6439 Node* input = assembler->Parameter(0); | 6448 Node* input = assembler->Parameter(0); |
6440 Node* context = assembler->Parameter(1); | 6449 Node* context = assembler->Parameter(1); |
6441 | 6450 |
6442 // Lookup the @@toPrimitive property on the {input}. | 6451 // Lookup the @@toPrimitive property on the {input}. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6491 // Convert using the OrdinaryToPrimitive algorithm instead. | 6500 // Convert using the OrdinaryToPrimitive algorithm instead. |
6492 assembler->Bind(&ordinary_to_primitive); | 6501 assembler->Bind(&ordinary_to_primitive); |
6493 { | 6502 { |
6494 Callable callable = CodeFactory::OrdinaryToPrimitive( | 6503 Callable callable = CodeFactory::OrdinaryToPrimitive( |
6495 assembler->isolate(), (hint == ToPrimitiveHint::kString) | 6504 assembler->isolate(), (hint == ToPrimitiveHint::kString) |
6496 ? OrdinaryToPrimitiveHint::kString | 6505 ? OrdinaryToPrimitiveHint::kString |
6497 : OrdinaryToPrimitiveHint::kNumber); | 6506 : OrdinaryToPrimitiveHint::kNumber); |
6498 assembler->TailCallStub(callable, context, input); | 6507 assembler->TailCallStub(callable, context, input); |
6499 } | 6508 } |
6500 } | 6509 } |
| 6510 } // anonymous namespace |
6501 | 6511 |
6502 void Generate_NonPrimitiveToPrimitive_Default(CodeStubAssembler* assembler) { | 6512 void Builtins::Generate_NonPrimitiveToPrimitive_Default( |
| 6513 CodeStubAssembler* assembler) { |
6503 Generate_NonPrimitiveToPrimitive(assembler, ToPrimitiveHint::kDefault); | 6514 Generate_NonPrimitiveToPrimitive(assembler, ToPrimitiveHint::kDefault); |
6504 } | 6515 } |
6505 | 6516 |
6506 void Generate_NonPrimitiveToPrimitive_Number(CodeStubAssembler* assembler) { | 6517 void Builtins::Generate_NonPrimitiveToPrimitive_Number( |
| 6518 CodeStubAssembler* assembler) { |
6507 Generate_NonPrimitiveToPrimitive(assembler, ToPrimitiveHint::kNumber); | 6519 Generate_NonPrimitiveToPrimitive(assembler, ToPrimitiveHint::kNumber); |
6508 } | 6520 } |
6509 | 6521 |
6510 void Generate_NonPrimitiveToPrimitive_String(CodeStubAssembler* assembler) { | 6522 void Builtins::Generate_NonPrimitiveToPrimitive_String( |
| 6523 CodeStubAssembler* assembler) { |
6511 Generate_NonPrimitiveToPrimitive(assembler, ToPrimitiveHint::kString); | 6524 Generate_NonPrimitiveToPrimitive(assembler, ToPrimitiveHint::kString); |
6512 } | 6525 } |
6513 | 6526 |
6514 // ES6 section 7.1.3 ToNumber ( argument ) | 6527 // ES6 section 7.1.3 ToNumber ( argument ) |
6515 void Generate_NonNumberToNumber(CodeStubAssembler* assembler) { | 6528 void Builtins::Generate_NonNumberToNumber(CodeStubAssembler* assembler) { |
6516 typedef CodeStubAssembler::Label Label; | 6529 typedef CodeStubAssembler::Label Label; |
6517 typedef compiler::Node Node; | 6530 typedef compiler::Node Node; |
6518 typedef CodeStubAssembler::Variable Variable; | 6531 typedef CodeStubAssembler::Variable Variable; |
6519 | 6532 |
6520 Node* input = assembler->Parameter(0); | 6533 Node* input = assembler->Parameter(0); |
6521 Node* context = assembler->Parameter(1); | 6534 Node* context = assembler->Parameter(1); |
6522 | 6535 |
6523 // We might need to loop once here due to ToPrimitive conversions. | 6536 // We might need to loop once here due to ToPrimitive conversions. |
6524 Variable var_input(assembler, MachineRepresentation::kTagged); | 6537 Variable var_input(assembler, MachineRepresentation::kTagged); |
6525 Label loop(assembler, &var_input); | 6538 Label loop(assembler, &var_input); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6602 // Note: We cannot tail call to the runtime here, as js-to-wasm | 6615 // Note: We cannot tail call to the runtime here, as js-to-wasm |
6603 // trampolines also use this code currently, and they declare all | 6616 // trampolines also use this code currently, and they declare all |
6604 // outgoing parameters as untagged, while we would push a tagged | 6617 // outgoing parameters as untagged, while we would push a tagged |
6605 // object here. | 6618 // object here. |
6606 Node* result = assembler->CallRuntime(Runtime::kToNumber, context, input); | 6619 Node* result = assembler->CallRuntime(Runtime::kToNumber, context, input); |
6607 assembler->Return(result); | 6620 assembler->Return(result); |
6608 } | 6621 } |
6609 } | 6622 } |
6610 } | 6623 } |
6611 | 6624 |
6612 void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { | 6625 void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { |
6613 ElementHandlerCompiler::GenerateStoreSlow(masm); | 6626 ElementHandlerCompiler::GenerateStoreSlow(masm); |
6614 } | 6627 } |
6615 | 6628 |
6616 void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { | 6629 void Builtins::Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { |
6617 NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm); | 6630 NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm); |
6618 } | 6631 } |
6619 | 6632 |
6620 void Generate_KeyedStoreIC_Megamorphic(MacroAssembler* masm) { | 6633 void Builtins::Generate_KeyedStoreIC_Megamorphic(MacroAssembler* masm) { |
6621 KeyedStoreIC::GenerateMegamorphic(masm, SLOPPY); | 6634 KeyedStoreIC::GenerateMegamorphic(masm, SLOPPY); |
6622 } | 6635 } |
6623 | 6636 |
6624 void Generate_KeyedStoreIC_Megamorphic_Strict(MacroAssembler* masm) { | 6637 void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict(MacroAssembler* masm) { |
6625 KeyedStoreIC::GenerateMegamorphic(masm, STRICT); | 6638 KeyedStoreIC::GenerateMegamorphic(masm, STRICT); |
6626 } | 6639 } |
6627 | 6640 |
6628 void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { | 6641 void Builtins::Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { |
6629 KeyedStoreIC::GenerateMiss(masm); | 6642 KeyedStoreIC::GenerateMiss(masm); |
6630 } | 6643 } |
6631 | 6644 |
6632 void Generate_Return_DebugBreak(MacroAssembler* masm) { | 6645 void Builtins::Generate_Return_DebugBreak(MacroAssembler* masm) { |
6633 DebugCodegen::GenerateDebugBreakStub(masm, | 6646 DebugCodegen::GenerateDebugBreakStub(masm, |
6634 DebugCodegen::SAVE_RESULT_REGISTER); | 6647 DebugCodegen::SAVE_RESULT_REGISTER); |
6635 } | 6648 } |
6636 | 6649 |
6637 void Generate_Slot_DebugBreak(MacroAssembler* masm) { | 6650 void Builtins::Generate_Slot_DebugBreak(MacroAssembler* masm) { |
6638 DebugCodegen::GenerateDebugBreakStub(masm, | 6651 DebugCodegen::GenerateDebugBreakStub(masm, |
6639 DebugCodegen::IGNORE_RESULT_REGISTER); | 6652 DebugCodegen::IGNORE_RESULT_REGISTER); |
6640 } | 6653 } |
6641 | 6654 |
6642 void Generate_FrameDropper_LiveEdit(MacroAssembler* masm) { | 6655 void Builtins::Generate_FrameDropper_LiveEdit(MacroAssembler* masm) { |
6643 DebugCodegen::GenerateFrameDropperLiveEdit(masm); | 6656 DebugCodegen::GenerateFrameDropperLiveEdit(masm); |
6644 } | 6657 } |
6645 | 6658 |
6646 } // namespace | |
6647 | |
6648 Builtins::Builtins() : initialized_(false) { | 6659 Builtins::Builtins() : initialized_(false) { |
6649 memset(builtins_, 0, sizeof(builtins_[0]) * builtin_count); | 6660 memset(builtins_, 0, sizeof(builtins_[0]) * builtin_count); |
6650 } | 6661 } |
6651 | 6662 |
6652 Builtins::~Builtins() {} | 6663 Builtins::~Builtins() {} |
6653 | 6664 |
6654 namespace { | 6665 namespace { |
6655 void PostBuildProfileAndTracing(Isolate* isolate, Code* code, | 6666 void PostBuildProfileAndTracing(Isolate* isolate, Code* code, |
6656 const char* name) { | 6667 const char* name) { |
6657 PROFILE(isolate, CodeCreateEvent(CodeEventListener::BUILTIN_TAG, | 6668 PROFILE(isolate, CodeCreateEvent(CodeEventListener::BUILTIN_TAG, |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7062 a->Bind(&u32); | 7073 a->Bind(&u32); |
7063 a->AtomicStore(MachineRepresentation::kWord32, backing_store, | 7074 a->AtomicStore(MachineRepresentation::kWord32, backing_store, |
7064 a->WordShl(index_word, 2), value_word32); | 7075 a->WordShl(index_word, 2), value_word32); |
7065 a->Return(value_integer); | 7076 a->Return(value_integer); |
7066 | 7077 |
7067 // This shouldn't happen, we've already validated the type. | 7078 // This shouldn't happen, we've already validated the type. |
7068 a->Bind(&other); | 7079 a->Bind(&other); |
7069 a->Return(a->Int32Constant(0)); | 7080 a->Return(a->Int32Constant(0)); |
7070 } | 7081 } |
7071 | 7082 |
| 7083 void Builtins::Generate_CallFunction_ReceiverIsNullOrUndefined( |
| 7084 MacroAssembler* masm) { |
| 7085 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, |
| 7086 TailCallMode::kDisallow); |
| 7087 } |
| 7088 |
| 7089 void Builtins::Generate_CallFunction_ReceiverIsNotNullOrUndefined( |
| 7090 MacroAssembler* masm) { |
| 7091 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, |
| 7092 TailCallMode::kDisallow); |
| 7093 } |
| 7094 |
| 7095 void Builtins::Generate_CallFunction_ReceiverIsAny(MacroAssembler* masm) { |
| 7096 Generate_CallFunction(masm, ConvertReceiverMode::kAny, |
| 7097 TailCallMode::kDisallow); |
| 7098 } |
| 7099 |
| 7100 void Builtins::Generate_TailCallFunction_ReceiverIsNullOrUndefined( |
| 7101 MacroAssembler* masm) { |
| 7102 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, |
| 7103 TailCallMode::kAllow); |
| 7104 } |
| 7105 |
| 7106 void Builtins::Generate_TailCallFunction_ReceiverIsNotNullOrUndefined( |
| 7107 MacroAssembler* masm) { |
| 7108 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, |
| 7109 TailCallMode::kAllow); |
| 7110 } |
| 7111 |
| 7112 void Builtins::Generate_TailCallFunction_ReceiverIsAny(MacroAssembler* masm) { |
| 7113 Generate_CallFunction(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow); |
| 7114 } |
| 7115 |
| 7116 void Builtins::Generate_CallBoundFunction(MacroAssembler* masm) { |
| 7117 Generate_CallBoundFunctionImpl(masm, TailCallMode::kDisallow); |
| 7118 } |
| 7119 |
| 7120 void Builtins::Generate_TailCallBoundFunction(MacroAssembler* masm) { |
| 7121 Generate_CallBoundFunctionImpl(masm, TailCallMode::kAllow); |
| 7122 } |
| 7123 |
| 7124 void Builtins::Generate_Call_ReceiverIsNullOrUndefined(MacroAssembler* masm) { |
| 7125 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined, |
| 7126 TailCallMode::kDisallow); |
| 7127 } |
| 7128 |
| 7129 void Builtins::Generate_Call_ReceiverIsNotNullOrUndefined( |
| 7130 MacroAssembler* masm) { |
| 7131 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined, |
| 7132 TailCallMode::kDisallow); |
| 7133 } |
| 7134 |
| 7135 void Builtins::Generate_Call_ReceiverIsAny(MacroAssembler* masm) { |
| 7136 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kDisallow); |
| 7137 } |
| 7138 |
| 7139 void Builtins::Generate_TailCall_ReceiverIsNullOrUndefined( |
| 7140 MacroAssembler* masm) { |
| 7141 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined, |
| 7142 TailCallMode::kAllow); |
| 7143 } |
| 7144 |
| 7145 void Builtins::Generate_TailCall_ReceiverIsNotNullOrUndefined( |
| 7146 MacroAssembler* masm) { |
| 7147 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined, |
| 7148 TailCallMode::kAllow); |
| 7149 } |
| 7150 |
| 7151 void Builtins::Generate_TailCall_ReceiverIsAny(MacroAssembler* masm) { |
| 7152 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow); |
| 7153 } |
| 7154 |
| 7155 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
| 7156 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kDisallow, |
| 7157 CallableType::kAny); |
| 7158 } |
| 7159 void Builtins::Generate_InterpreterPushArgsAndTailCall(MacroAssembler* masm) { |
| 7160 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, |
| 7161 CallableType::kAny); |
| 7162 } |
| 7163 |
| 7164 void Builtins::Generate_InterpreterPushArgsAndCallFunction( |
| 7165 MacroAssembler* masm) { |
| 7166 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kDisallow, |
| 7167 CallableType::kJSFunction); |
| 7168 } |
| 7169 |
| 7170 void Builtins::Generate_InterpreterPushArgsAndTailCallFunction( |
| 7171 MacroAssembler* masm) { |
| 7172 return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, |
| 7173 CallableType::kJSFunction); |
| 7174 } |
| 7175 |
| 7176 void Builtins::Generate_MathMax(MacroAssembler* masm) { |
| 7177 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); |
| 7178 } |
| 7179 |
| 7180 void Builtins::Generate_MathMin(MacroAssembler* masm) { |
| 7181 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); |
| 7182 } |
| 7183 |
7072 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ | 7184 #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ |
7073 Handle<Code> Builtins::Name() { \ | 7185 Handle<Code> Builtins::Name() { \ |
7074 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ | 7186 Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ |
7075 return Handle<Code>(code_address); \ | 7187 return Handle<Code>(code_address); \ |
7076 } | 7188 } |
7077 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) | 7189 BUILTIN_LIST_ALL(DEFINE_BUILTIN_ACCESSOR) |
7078 #undef DEFINE_BUILTIN_ACCESSOR | 7190 #undef DEFINE_BUILTIN_ACCESSOR |
7079 | 7191 |
7080 } // namespace internal | 7192 } // namespace internal |
7081 } // namespace v8 | 7193 } // namespace v8 |
OLD | NEW |