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 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // Lookup the {name} on the {input}. | 243 // Lookup the {name} on the {input}. |
244 Callable callable = CodeFactory::GetProperty(assembler->isolate()); | 244 Callable callable = CodeFactory::GetProperty(assembler->isolate()); |
245 Node* name_string = assembler->HeapConstant(name); | 245 Node* name_string = assembler->HeapConstant(name); |
246 Node* method = assembler->CallStub(callable, context, input, name_string); | 246 Node* method = assembler->CallStub(callable, context, input, name_string); |
247 | 247 |
248 // Check if the {method} is callable. | 248 // Check if the {method} is callable. |
249 Label if_methodiscallable(assembler), | 249 Label if_methodiscallable(assembler), |
250 if_methodisnotcallable(assembler, Label::kDeferred); | 250 if_methodisnotcallable(assembler, Label::kDeferred); |
251 assembler->GotoIf(assembler->TaggedIsSmi(method), &if_methodisnotcallable); | 251 assembler->GotoIf(assembler->TaggedIsSmi(method), &if_methodisnotcallable); |
252 Node* method_map = assembler->LoadMap(method); | 252 Node* method_map = assembler->LoadMap(method); |
253 Node* method_bit_field = assembler->LoadMapBitField(method_map); | 253 assembler->Branch(assembler->IsCallableMap(method_map), |
254 assembler->Branch( | 254 &if_methodiscallable, &if_methodisnotcallable); |
255 assembler->Word32Equal( | |
256 assembler->Word32And(method_bit_field, assembler->Int32Constant( | |
257 1 << Map::kIsCallable)), | |
258 assembler->Int32Constant(0)), | |
259 &if_methodisnotcallable, &if_methodiscallable); | |
260 | 255 |
261 assembler->Bind(&if_methodiscallable); | 256 assembler->Bind(&if_methodiscallable); |
262 { | 257 { |
263 // Call the {method} on the {input}. | 258 // Call the {method} on the {input}. |
264 Callable callable = CodeFactory::Call(assembler->isolate()); | 259 Callable callable = CodeFactory::Call(assembler->isolate()); |
265 Node* result = assembler->CallJS(callable, context, method, input); | 260 Node* result = assembler->CallJS(callable, context, method, input); |
266 var_result.Bind(result); | 261 var_result.Bind(result); |
267 | 262 |
268 // Return the {result} if it is a primitive. | 263 // Return the {result} if it is a primitive. |
269 assembler->GotoIf(assembler->TaggedIsSmi(result), &return_result); | 264 assembler->GotoIf(assembler->TaggedIsSmi(result), &return_result); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 typedef TypeofDescriptor Descriptor; | 468 typedef TypeofDescriptor Descriptor; |
474 | 469 |
475 Node* object = assembler->Parameter(Descriptor::kObject); | 470 Node* object = assembler->Parameter(Descriptor::kObject); |
476 Node* context = assembler->Parameter(Descriptor::kContext); | 471 Node* context = assembler->Parameter(Descriptor::kContext); |
477 | 472 |
478 assembler->Return(assembler->Typeof(object, context)); | 473 assembler->Return(assembler->Typeof(object, context)); |
479 } | 474 } |
480 | 475 |
481 } // namespace internal | 476 } // namespace internal |
482 } // namespace v8 | 477 } // namespace v8 |
OLD | NEW |