| 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 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 Node* code32 = assembler->TruncateTaggedToWord32(context, code); | 44 Node* code32 = assembler->TruncateTaggedToWord32(context, code); |
| 45 Node* code16 = assembler->Word32And( | 45 Node* code16 = assembler->Word32And( |
| 46 code32, assembler->Int32Constant(String::kMaxUtf16CodeUnit)); | 46 code32, assembler->Int32Constant(String::kMaxUtf16CodeUnit)); |
| 47 Node* result = assembler->StringFromCharCode(code16); | 47 Node* result = assembler->StringFromCharCode(code16); |
| 48 assembler->Return(result); | 48 assembler->Return(result); |
| 49 } | 49 } |
| 50 | 50 |
| 51 assembler->Bind(&if_notoneargument); | 51 assembler->Bind(&if_notoneargument); |
| 52 { | 52 { |
| 53 // Determine the resulting string length. | 53 // Determine the resulting string length. |
| 54 Node* parent_frame_length = | 54 Node* length = assembler->LoadAndUntagSmi( |
| 55 assembler->Load(MachineType::Pointer(), parent_frame_pointer, | 55 parent_frame_pointer, ArgumentsAdaptorFrameConstants::kLengthOffset); |
| 56 assembler->IntPtrConstant( | |
| 57 ArgumentsAdaptorFrameConstants::kLengthOffset)); | |
| 58 Node* length = assembler->SmiToWord(parent_frame_length); | |
| 59 | 56 |
| 60 // Assume that the resulting string contains only one-byte characters. | 57 // Assume that the resulting string contains only one-byte characters. |
| 61 Node* result = assembler->AllocateSeqOneByteString(context, length); | 58 Node* result = assembler->AllocateSeqOneByteString(context, length); |
| 62 | 59 |
| 63 // Truncate all input parameters and append them to the resulting string. | 60 // Truncate all input parameters and append them to the resulting string. |
| 64 Variable var_offset(assembler, MachineType::PointerRepresentation()); | 61 Variable var_offset(assembler, MachineType::PointerRepresentation()); |
| 65 Label loop(assembler, &var_offset), done_loop(assembler); | 62 Label loop(assembler, &var_offset), done_loop(assembler); |
| 66 var_offset.Bind(assembler->IntPtrConstant(0)); | 63 var_offset.Bind(assembler->IntPtrConstant(0)); |
| 67 assembler->Goto(&loop); | 64 assembler->Goto(&loop); |
| 68 assembler->Bind(&loop); | 65 assembler->Bind(&loop); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 Node* receiver = assembler->Parameter(0); | 517 Node* receiver = assembler->Parameter(0); |
| 521 Node* context = assembler->Parameter(3); | 518 Node* context = assembler->Parameter(3); |
| 522 | 519 |
| 523 Node* result = assembler->ToThisValue( | 520 Node* result = assembler->ToThisValue( |
| 524 context, receiver, PrimitiveType::kString, "String.prototype.valueOf"); | 521 context, receiver, PrimitiveType::kString, "String.prototype.valueOf"); |
| 525 assembler->Return(result); | 522 assembler->Return(result); |
| 526 } | 523 } |
| 527 | 524 |
| 528 } // namespace internal | 525 } // namespace internal |
| 529 } // namespace v8 | 526 } // namespace v8 |
| OLD | NEW |