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 #include "src/property-descriptor.h" | 9 #include "src/property-descriptor.h" |
10 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 typedef compiler::Node Node; | 223 typedef compiler::Node Node; |
224 typedef CodeStubAssembler::Label Label; | 224 typedef CodeStubAssembler::Label Label; |
225 | 225 |
226 Label if_notsmi(assembler); | 226 Label if_notsmi(assembler); |
227 assembler->Branch(assembler->WordIsSmi(object), if_notstring, &if_notsmi); | 227 assembler->Branch(assembler->WordIsSmi(object), if_notstring, &if_notsmi); |
228 | 228 |
229 assembler->Bind(&if_notsmi); | 229 assembler->Bind(&if_notsmi); |
230 { | 230 { |
231 Node* instance_type = assembler->LoadInstanceType(object); | 231 Node* instance_type = assembler->LoadInstanceType(object); |
232 | 232 |
233 assembler->Branch( | 233 assembler->Branch(assembler->IsStringInstanceType(instance_type), if_string, |
234 assembler->Int32LessThan( | 234 if_notstring); |
235 instance_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE)), | |
236 if_string, if_notstring); | |
237 } | 235 } |
238 } | 236 } |
239 | 237 |
240 void ReturnToStringFormat(CodeStubAssembler* assembler, compiler::Node* context, | 238 void ReturnToStringFormat(CodeStubAssembler* assembler, compiler::Node* context, |
241 compiler::Node* string) { | 239 compiler::Node* string) { |
242 typedef compiler::Node Node; | 240 typedef compiler::Node Node; |
243 | 241 |
244 Node* lhs = assembler->HeapConstant( | 242 Node* lhs = assembler->HeapConstant( |
245 assembler->factory()->NewStringFromStaticChars("[object ")); | 243 assembler->factory()->NewStringFromStaticChars("[object ")); |
246 Node* rhs = assembler->HeapConstant( | 244 Node* rhs = assembler->HeapConstant( |
247 assembler->factory()->NewStringFromStaticChars("]")); | 245 assembler->factory()->NewStringFromStaticChars("]")); |
248 | 246 |
249 Callable callable = CodeFactory::StringAdd( | 247 Callable callable = CodeFactory::StringAdd( |
250 assembler->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); | 248 assembler->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); |
251 | 249 |
252 assembler->Return(assembler->CallStub( | 250 assembler->Return(assembler->CallStub( |
253 callable, context, assembler->CallStub(callable, context, lhs, string), | 251 callable, context, assembler->CallStub(callable, context, lhs, string), |
254 rhs)); | 252 rhs)); |
255 } | 253 } |
256 | 254 |
257 void ReturnIfPrimitive(CodeStubAssembler* assembler, | 255 void ReturnIfPrimitive(CodeStubAssembler* assembler, |
258 compiler::Node* instance_type, | 256 compiler::Node* instance_type, |
259 CodeStubAssembler::Label* return_string, | 257 CodeStubAssembler::Label* return_string, |
260 CodeStubAssembler::Label* return_boolean, | 258 CodeStubAssembler::Label* return_boolean, |
261 CodeStubAssembler::Label* return_number) { | 259 CodeStubAssembler::Label* return_number) { |
262 assembler->GotoIf( | 260 assembler->GotoIf(assembler->IsStringInstanceType(instance_type), |
263 assembler->Int32LessThan(instance_type, | 261 return_string); |
264 assembler->Int32Constant(FIRST_NONSTRING_TYPE)), | |
265 return_string); | |
266 | 262 |
267 assembler->GotoIf(assembler->Word32Equal( | 263 assembler->GotoIf(assembler->Word32Equal( |
268 instance_type, assembler->Int32Constant(ODDBALL_TYPE)), | 264 instance_type, assembler->Int32Constant(ODDBALL_TYPE)), |
269 return_boolean); | 265 return_boolean); |
270 | 266 |
271 assembler->GotoIf( | 267 assembler->GotoIf( |
272 assembler->Word32Equal(instance_type, | 268 assembler->Word32Equal(instance_type, |
273 assembler->Int32Constant(HEAP_NUMBER_TYPE)), | 269 assembler->Int32Constant(HEAP_NUMBER_TYPE)), |
274 return_number); | 270 return_number); |
275 } | 271 } |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 if (object->IsJSReceiver()) { | 901 if (object->IsJSReceiver()) { |
906 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), | 902 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), |
907 SEALED, Object::THROW_ON_ERROR), | 903 SEALED, Object::THROW_ON_ERROR), |
908 isolate->heap()->exception()); | 904 isolate->heap()->exception()); |
909 } | 905 } |
910 return *object; | 906 return *object; |
911 } | 907 } |
912 | 908 |
913 } // namespace internal | 909 } // namespace internal |
914 } // namespace v8 | 910 } // namespace v8 |
OLD | NEW |