| 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/code-stubs.h" |     5 #include "src/code-stubs.h" | 
|     6  |     6  | 
|     7 #include <sstream> |     7 #include <sstream> | 
|     8  |     8  | 
|     9 #include "src/bootstrapper.h" |     9 #include "src/bootstrapper.h" | 
|    10 #include "src/code-factory.h" |    10 #include "src/code-factory.h" | 
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   515     assembler->StoreNoWriteBarrier(                                         \ |   515     assembler->StoreNoWriteBarrier(                                         \ | 
|   516         MachineRepresentation::kTagged, map,                                \ |   516         MachineRepresentation::kTagged, map,                                \ | 
|   517         assembler->HeapConstant(isolate()->factory()->type##_map()));       \ |   517         assembler->HeapConstant(isolate()->factory()->type##_map()));       \ | 
|   518     assembler->Return(result);                                              \ |   518     assembler->Return(result);                                              \ | 
|   519   } |   519   } | 
|   520 SIMD128_TYPES(SIMD128_GEN_ASM) |   520 SIMD128_TYPES(SIMD128_GEN_ASM) | 
|   521 #undef SIMD128_GEN_ASM |   521 #undef SIMD128_GEN_ASM | 
|   522  |   522  | 
|   523 void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const { |   523 void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 
|   524   compiler::Node* value = assembler->Parameter(0); |   524   compiler::Node* value = assembler->Parameter(0); | 
|   525   compiler::Node* string = |   525   compiler::Node* string = assembler->LoadJSValueValue(value); | 
|   526       assembler->LoadObjectField(value, JSValue::kValueOffset); |   526   compiler::Node* result = assembler->LoadStringLength(string); | 
|   527   compiler::Node* result = |  | 
|   528       assembler->LoadObjectField(string, String::kLengthOffset); |  | 
|   529   assembler->Return(result); |   527   assembler->Return(result); | 
|   530 } |   528 } | 
|   531  |   529  | 
|   532 // static |   530 // static | 
|   533 compiler::Node* AddStub::Generate(CodeStubAssembler* assembler, |   531 compiler::Node* AddStub::Generate(CodeStubAssembler* assembler, | 
|   534                                   compiler::Node* left, compiler::Node* right, |   532                                   compiler::Node* left, compiler::Node* right, | 
|   535                                   compiler::Node* context) { |   533                                   compiler::Node* context) { | 
|   536   typedef CodeStubAssembler::Label Label; |   534   typedef CodeStubAssembler::Label Label; | 
|   537   typedef compiler::Node Node; |   535   typedef compiler::Node Node; | 
|   538   typedef CodeStubAssembler::Variable Variable; |   536   typedef CodeStubAssembler::Variable Variable; | 
| (...skipping 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3390     assembler->Branch(assembler->Word32Equal( |  3388     assembler->Branch(assembler->Word32Equal( | 
|  3391                           assembler->Word32And(both_instance_types, |  3389                           assembler->Word32And(both_instance_types, | 
|  3392                                                assembler->Int32Constant( |  3390                                                assembler->Int32Constant( | 
|  3393                                                    kBothSeqOneByteStringMask)), |  3391                                                    kBothSeqOneByteStringMask)), | 
|  3394                           assembler->Int32Constant(kBothSeqOneByteStringTag)), |  3392                           assembler->Int32Constant(kBothSeqOneByteStringTag)), | 
|  3395                       &if_bothonebyteseqstrings, &if_notbothonebyteseqstrings); |  3393                       &if_bothonebyteseqstrings, &if_notbothonebyteseqstrings); | 
|  3396  |  3394  | 
|  3397     assembler->Bind(&if_bothonebyteseqstrings); |  3395     assembler->Bind(&if_bothonebyteseqstrings); | 
|  3398     { |  3396     { | 
|  3399       // Load the length of {lhs} and {rhs}. |  3397       // Load the length of {lhs} and {rhs}. | 
|  3400       Node* lhs_length = assembler->LoadObjectField(lhs, String::kLengthOffset); |  3398       Node* lhs_length = assembler->LoadStringLength(lhs); | 
|  3401       Node* rhs_length = assembler->LoadObjectField(rhs, String::kLengthOffset); |  3399       Node* rhs_length = assembler->LoadStringLength(rhs); | 
|  3402  |  3400  | 
|  3403       // Determine the minimum length. |  3401       // Determine the minimum length. | 
|  3404       Node* length = assembler->SmiMin(lhs_length, rhs_length); |  3402       Node* length = assembler->SmiMin(lhs_length, rhs_length); | 
|  3405  |  3403  | 
|  3406       // Compute the effective offset of the first character. |  3404       // Compute the effective offset of the first character. | 
|  3407       Node* begin = assembler->IntPtrConstant(SeqOneByteString::kHeaderSize - |  3405       Node* begin = assembler->IntPtrConstant(SeqOneByteString::kHeaderSize - | 
|  3408                                               kHeapObjectTag); |  3406                                               kHeapObjectTag); | 
|  3409  |  3407  | 
|  3410       // Compute the first offset after the string from the length. |  3408       // Compute the first offset after the string from the length. | 
|  3411       Node* end = assembler->IntPtrAdd(begin, assembler->SmiUntag(length)); |  3409       Node* end = assembler->IntPtrAdd(begin, assembler->SmiUntag(length)); | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3562   assembler->Branch(assembler->WordEqual(lhs, rhs), &if_same, &if_notsame); |  3560   assembler->Branch(assembler->WordEqual(lhs, rhs), &if_same, &if_notsame); | 
|  3563  |  3561  | 
|  3564   assembler->Bind(&if_same); |  3562   assembler->Bind(&if_same); | 
|  3565   assembler->Goto(&if_equal); |  3563   assembler->Goto(&if_equal); | 
|  3566  |  3564  | 
|  3567   assembler->Bind(&if_notsame); |  3565   assembler->Bind(&if_notsame); | 
|  3568   { |  3566   { | 
|  3569     // The {lhs} and {rhs} don't refer to the exact same String object. |  3567     // The {lhs} and {rhs} don't refer to the exact same String object. | 
|  3570  |  3568  | 
|  3571     // Load the length of {lhs} and {rhs}. |  3569     // Load the length of {lhs} and {rhs}. | 
|  3572     Node* lhs_length = assembler->LoadObjectField(lhs, String::kLengthOffset); |  3570     Node* lhs_length = assembler->LoadStringLength(lhs); | 
|  3573     Node* rhs_length = assembler->LoadObjectField(rhs, String::kLengthOffset); |  3571     Node* rhs_length = assembler->LoadStringLength(rhs); | 
|  3574  |  3572  | 
|  3575     // Check if the lengths of {lhs} and {rhs} are equal. |  3573     // Check if the lengths of {lhs} and {rhs} are equal. | 
|  3576     Label if_lengthisequal(assembler), if_lengthisnotequal(assembler); |  3574     Label if_lengthisequal(assembler), if_lengthisnotequal(assembler); | 
|  3577     assembler->Branch(assembler->WordEqual(lhs_length, rhs_length), |  3575     assembler->Branch(assembler->WordEqual(lhs_length, rhs_length), | 
|  3578                       &if_lengthisequal, &if_lengthisnotequal); |  3576                       &if_lengthisequal, &if_lengthisnotequal); | 
|  3579  |  3577  | 
|  3580     assembler->Bind(&if_lengthisequal); |  3578     assembler->Bind(&if_lengthisequal); | 
|  3581     { |  3579     { | 
|  3582       // Load instance types of {lhs} and {rhs}. |  3580       // Load instance types of {lhs} and {rhs}. | 
|  3583       Node* lhs_instance_type = assembler->LoadInstanceType(lhs); |  3581       Node* lhs_instance_type = assembler->LoadInstanceType(lhs); | 
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5045   if (type->Is(Type::UntaggedPointer())) { |  5043   if (type->Is(Type::UntaggedPointer())) { | 
|  5046     return Representation::External(); |  5044     return Representation::External(); | 
|  5047   } |  5045   } | 
|  5048  |  5046  | 
|  5049   DCHECK(!type->Is(Type::Untagged())); |  5047   DCHECK(!type->Is(Type::Untagged())); | 
|  5050   return Representation::Tagged(); |  5048   return Representation::Tagged(); | 
|  5051 } |  5049 } | 
|  5052  |  5050  | 
|  5053 }  // namespace internal |  5051 }  // namespace internal | 
|  5054 }  // namespace v8 |  5052 }  // namespace v8 | 
| OLD | NEW |