| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/cpu-profiler.h" | 7 #include "src/cpu-profiler.h" |
| 8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
| 9 #include "src/ic/ic-inl.h" | 9 #include "src/ic/ic-inl.h" |
| 10 #include "src/ic/ic-compiler.h" | 10 #include "src/ic/ic-compiler.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 357 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 358 ElementsKind elements_kind = receiver_map->elements_kind(); | 358 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 359 if (!transitioned_map.is_null()) { | 359 if (!transitioned_map.is_null()) { |
| 360 cached_stub = | 360 cached_stub = |
| 361 ElementsTransitionAndStoreStub(isolate(), elements_kind, | 361 ElementsTransitionAndStoreStub(isolate(), elements_kind, |
| 362 transitioned_map->elements_kind(), | 362 transitioned_map->elements_kind(), |
| 363 is_js_array, store_mode).GetCode(); | 363 is_js_array, store_mode).GetCode(); |
| 364 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { | 364 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { |
| 365 cached_stub = isolate()->builtins()->KeyedStoreIC_Slow(); | 365 cached_stub = isolate()->builtins()->KeyedStoreIC_Slow(); |
| 366 } else { | 366 } else { |
| 367 if (receiver_map->has_fast_elements() || | 367 if (IsSloppyArgumentsElements(elements_kind)) { |
| 368 receiver_map->has_external_array_elements() || | 368 cached_stub = KeyedStoreSloppyArgumentsStub(isolate()).GetCode(); |
| 369 receiver_map->has_fixed_typed_array_elements()) { | 369 } else if (receiver_map->has_fast_elements() || |
| 370 receiver_map->has_external_array_elements() || |
| 371 receiver_map->has_fixed_typed_array_elements()) { |
| 370 cached_stub = StoreFastElementStub(isolate(), is_js_array, | 372 cached_stub = StoreFastElementStub(isolate(), is_js_array, |
| 371 elements_kind, store_mode).GetCode(); | 373 elements_kind, store_mode).GetCode(); |
| 372 } else { | 374 } else { |
| 373 cached_stub = StoreElementStub(isolate(), elements_kind).GetCode(); | 375 cached_stub = StoreElementStub(isolate(), elements_kind).GetCode(); |
| 374 } | 376 } |
| 375 } | 377 } |
| 376 DCHECK(!cached_stub.is_null()); | 378 DCHECK(!cached_stub.is_null()); |
| 377 handlers.Add(cached_stub); | 379 handlers.Add(cached_stub); |
| 378 transitioned_maps.Add(transitioned_map); | 380 transitioned_maps.Add(transitioned_map); |
| 379 } | 381 } |
| 380 | 382 |
| 381 Handle<Code> code = CompileKeyedStorePolymorphic(receiver_maps, &handlers, | 383 Handle<Code> code = CompileKeyedStorePolymorphic(receiver_maps, &handlers, |
| 382 &transitioned_maps); | 384 &transitioned_maps); |
| 383 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); | 385 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); |
| 384 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, 0)); | 386 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, 0)); |
| 385 return code; | 387 return code; |
| 386 } | 388 } |
| 387 | 389 |
| 388 | 390 |
| 389 #define __ ACCESS_MASM(masm()) | 391 #define __ ACCESS_MASM(masm()) |
| 390 | 392 |
| 391 | 393 |
| 392 Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphic( | 394 Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphic( |
| 393 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { | 395 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { |
| 394 ElementsKind elements_kind = receiver_map->elements_kind(); | 396 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 395 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; | 397 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 396 Handle<Code> stub; | 398 Handle<Code> stub; |
| 397 if (receiver_map->has_fast_elements() || | 399 if (receiver_map->has_sloppy_arguments_elements()) { |
| 398 receiver_map->has_external_array_elements() || | 400 stub = KeyedStoreSloppyArgumentsStub(isolate()).GetCode(); |
| 399 receiver_map->has_fixed_typed_array_elements()) { | 401 } else if (receiver_map->has_fast_elements() || |
| 402 receiver_map->has_external_array_elements() || |
| 403 receiver_map->has_fixed_typed_array_elements()) { |
| 400 stub = StoreFastElementStub(isolate(), is_jsarray, elements_kind, | 404 stub = StoreFastElementStub(isolate(), is_jsarray, elements_kind, |
| 401 store_mode).GetCode(); | 405 store_mode).GetCode(); |
| 402 } else { | 406 } else { |
| 403 stub = StoreElementStub(isolate(), elements_kind).GetCode(); | 407 stub = StoreElementStub(isolate(), elements_kind).GetCode(); |
| 404 } | 408 } |
| 405 | 409 |
| 406 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); | 410 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); |
| 407 | 411 |
| 408 __ DispatchWeakMap(receiver(), scratch1(), scratch2(), cell, stub, | 412 __ DispatchWeakMap(receiver(), scratch1(), scratch2(), cell, stub, |
| 409 DO_SMI_CHECK); | 413 DO_SMI_CHECK); |
| 410 | 414 |
| 411 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 415 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
| 412 | 416 |
| 413 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); | 417 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); |
| 414 } | 418 } |
| 415 | 419 |
| 416 | 420 |
| 417 #undef __ | 421 #undef __ |
| 418 } | 422 } |
| 419 } // namespace v8::internal | 423 } // namespace v8::internal |
| OLD | NEW |