| 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/code-stub-assembler.h" | 9 #include "src/code-stub-assembler.h" |
| 10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 assembler.Bind(&smi_transition); | 263 assembler.Bind(&smi_transition); |
| 264 { | 264 { |
| 265 Node* arg = args.AtIndex(arg_index.value()); | 265 Node* arg = args.AtIndex(arg_index.value()); |
| 266 assembler.GotoIf(assembler.TaggedIsSmi(arg), &default_label); | 266 assembler.GotoIf(assembler.TaggedIsSmi(arg), &default_label); |
| 267 Node* length = assembler.LoadJSArrayLength(receiver); | 267 Node* length = assembler.LoadJSArrayLength(receiver); |
| 268 // TODO(danno): Use the KeyedStoreGeneric stub here when possible, | 268 // TODO(danno): Use the KeyedStoreGeneric stub here when possible, |
| 269 // calling into the runtime to do the elements transition is overkill. | 269 // calling into the runtime to do the elements transition is overkill. |
| 270 assembler.CallRuntime(Runtime::kSetProperty, context, receiver, length, arg, | 270 assembler.CallRuntime(Runtime::kSetProperty, context, receiver, length, arg, |
| 271 assembler.SmiConstant(STRICT)); | 271 assembler.SmiConstant(STRICT)); |
| 272 assembler.Increment(arg_index); | 272 assembler.Increment(arg_index); |
| 273 // The runtime SetProperty call could have converted the array to dictionary |
| 274 // mode, which must be detected to abort the fast-path. |
| 275 Node* map = assembler.LoadMap(receiver); |
| 276 Node* bit_field2 = assembler.LoadMapBitField2(map); |
| 277 Node* kind = assembler.DecodeWord32<Map::ElementsKindBits>(bit_field2); |
| 278 assembler.GotoIf(assembler.Word32Equal( |
| 279 kind, assembler.Int32Constant(DICTIONARY_ELEMENTS)), |
| 280 &default_label); |
| 281 |
| 273 assembler.GotoIfNotNumber(arg, &object_push); | 282 assembler.GotoIfNotNumber(arg, &object_push); |
| 274 assembler.Goto(&double_push); | 283 assembler.Goto(&double_push); |
| 275 } | 284 } |
| 276 | 285 |
| 277 assembler.Bind(&object_push_pre); | 286 assembler.Bind(&object_push_pre); |
| 278 { | 287 { |
| 279 assembler.Branch(assembler.Int32GreaterThan( | 288 assembler.Branch(assembler.Int32GreaterThan( |
| 280 kind, assembler.Int32Constant(FAST_HOLEY_ELEMENTS)), | 289 kind, assembler.Int32Constant(FAST_HOLEY_ELEMENTS)), |
| 281 &double_push, &object_push); | 290 &double_push, &object_push); |
| 282 } | 291 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 303 assembler.Bind(&double_transition); | 312 assembler.Bind(&double_transition); |
| 304 { | 313 { |
| 305 Node* arg = args.AtIndex(arg_index.value()); | 314 Node* arg = args.AtIndex(arg_index.value()); |
| 306 assembler.GotoIfNumber(arg, &default_label); | 315 assembler.GotoIfNumber(arg, &default_label); |
| 307 Node* length = assembler.LoadJSArrayLength(receiver); | 316 Node* length = assembler.LoadJSArrayLength(receiver); |
| 308 // TODO(danno): Use the KeyedStoreGeneric stub here when possible, | 317 // TODO(danno): Use the KeyedStoreGeneric stub here when possible, |
| 309 // calling into the runtime to do the elements transition is overkill. | 318 // calling into the runtime to do the elements transition is overkill. |
| 310 assembler.CallRuntime(Runtime::kSetProperty, context, receiver, length, arg, | 319 assembler.CallRuntime(Runtime::kSetProperty, context, receiver, length, arg, |
| 311 assembler.SmiConstant(STRICT)); | 320 assembler.SmiConstant(STRICT)); |
| 312 assembler.Increment(arg_index); | 321 assembler.Increment(arg_index); |
| 322 // The runtime SetProperty call could have converted the array to dictionary |
| 323 // mode, which must be detected to abort the fast-path. |
| 324 Node* map = assembler.LoadMap(receiver); |
| 325 Node* bit_field2 = assembler.LoadMapBitField2(map); |
| 326 Node* kind = assembler.DecodeWord32<Map::ElementsKindBits>(bit_field2); |
| 327 assembler.GotoIf(assembler.Word32Equal( |
| 328 kind, assembler.Int32Constant(DICTIONARY_ELEMENTS)), |
| 329 &default_label); |
| 313 assembler.Goto(&object_push); | 330 assembler.Goto(&object_push); |
| 314 } | 331 } |
| 315 | 332 |
| 316 // Fallback that stores un-processed arguments using the full, heavyweight | 333 // Fallback that stores un-processed arguments using the full, heavyweight |
| 317 // SetProperty machinery. | 334 // SetProperty machinery. |
| 318 assembler.Bind(&default_label); | 335 assembler.Bind(&default_label); |
| 319 { | 336 { |
| 320 args.ForEach( | 337 args.ForEach( |
| 321 [&assembler, receiver, context](Node* arg) { | 338 [&assembler, receiver, context](Node* arg) { |
| 322 Node* length = assembler.LoadJSArrayLength(receiver); | 339 Node* length = assembler.LoadJSArrayLength(receiver); |
| (...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2755 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation); | 2772 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation); |
| 2756 Node* result = | 2773 Node* result = |
| 2757 assembler.CallRuntime(Runtime::kThrowTypeError, context, message, | 2774 assembler.CallRuntime(Runtime::kThrowTypeError, context, message, |
| 2758 assembler.HeapConstant(operation)); | 2775 assembler.HeapConstant(operation)); |
| 2759 assembler.Return(result); | 2776 assembler.Return(result); |
| 2760 } | 2777 } |
| 2761 } | 2778 } |
| 2762 | 2779 |
| 2763 } // namespace internal | 2780 } // namespace internal |
| 2764 } // namespace v8 | 2781 } // namespace v8 |
| OLD | NEW |