Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: src/ia32/ic-ia32.cc

Issue 458813002: Prototype implementation of GET_OWN_PROPERTY intrinsic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic-inl.h" 10 #include "src/ic-inl.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 __ mov(scratch, FieldOperand(backing_store, FixedArray::kLengthOffset)); 336 __ mov(scratch, FieldOperand(backing_store, FixedArray::kLengthOffset));
337 __ cmp(key, scratch); 337 __ cmp(key, scratch);
338 __ j(greater_equal, slow_case); 338 __ j(greater_equal, slow_case);
339 return FieldOperand(backing_store, 339 return FieldOperand(backing_store,
340 key, 340 key,
341 times_half_pointer_size, 341 times_half_pointer_size,
342 FixedArray::kHeaderSize); 342 FixedArray::kHeaderSize);
343 } 343 }
344 344
345 345
346 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 346 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm, ExtraICState extra_state ) {
347 // The return address is on the stack. 347 // The return address is on the stack.
348 Label slow, check_name, index_smi, index_name, property_array_property; 348 Label slow, check_name, index_smi, index_name, property_array_property;
349 Label probe_dictionary, check_number_dictionary; 349 Label probe_dictionary, check_number_dictionary;
350 350
351 PropertyLookupMode lookup_mode = GetPropertyLookupMode(extra_state);
351 Register receiver = ReceiverRegister(); 352 Register receiver = ReceiverRegister();
352 Register key = NameRegister(); 353 Register key = NameRegister();
353 DCHECK(receiver.is(edx)); 354 DCHECK(receiver.is(edx));
354 DCHECK(key.is(ecx)); 355 DCHECK(key.is(ecx));
355 356
356 // Check that the key is a smi. 357 // Check that the key is a smi.
357 __ JumpIfNotSmi(key, &check_name); 358 __ JumpIfNotSmi(key, &check_name);
358 __ bind(&index_smi); 359 __ bind(&index_smi);
359 // Now the key is known to be a smi. This place is also jumped to from 360 // Now the key is known to be a smi. This place is also jumped to from
360 // where a numeric string is converted to a smi. 361 // where a numeric string is converted to a smi.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 __ pop(receiver); 393 __ pop(receiver);
393 __ ret(0); 394 __ ret(0);
394 395
395 __ bind(&slow_pop_receiver); 396 __ bind(&slow_pop_receiver);
396 // Pop the receiver from the stack and jump to runtime. 397 // Pop the receiver from the stack and jump to runtime.
397 __ pop(receiver); 398 __ pop(receiver);
398 399
399 __ bind(&slow); 400 __ bind(&slow);
400 // Slow case: jump to runtime. 401 // Slow case: jump to runtime.
401 __ IncrementCounter(counters->keyed_load_generic_slow(), 1); 402 __ IncrementCounter(counters->keyed_load_generic_slow(), 1);
402 GenerateRuntimeGetProperty(masm); 403 if (lookup_mode == OWN_PROPERTY_LOOKUP) {
404 GenerateRuntimeGetOwnProperty(masm);
405 } else {
406 GenerateRuntimeGetProperty(masm);
407 }
403 408
404 __ bind(&check_name); 409 __ bind(&check_name);
405 GenerateKeyNameCheck(masm, key, eax, ebx, &index_name, &slow); 410 GenerateKeyNameCheck(masm, key, eax, ebx, &index_name, &slow);
406 411
407 GenerateKeyedLoadReceiverCheck( 412 GenerateKeyedLoadReceiverCheck(
408 masm, receiver, eax, Map::kHasNamedInterceptor, &slow); 413 masm, receiver, eax, Map::kHasNamedInterceptor, &slow);
409 414
410 // If the receiver is a fast-case object, check the keyed lookup 415 // If the receiver is a fast-case object, check the keyed lookup
411 // cache. Otherwise probe the dictionary. 416 // cache. Otherwise probe the dictionary.
412 __ mov(ebx, FieldOperand(receiver, JSObject::kPropertiesOffset)); 417 __ mov(ebx, FieldOperand(receiver, JSObject::kPropertiesOffset));
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 __ cmp(key, FieldOperand(receiver, JSArray::kLengthOffset)); // Compare smis. 882 __ cmp(key, FieldOperand(receiver, JSArray::kLengthOffset)); // Compare smis.
878 __ j(above_equal, &extra); 883 __ j(above_equal, &extra);
879 884
880 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, 885 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double,
881 &slow, kCheckMap, kDontIncrementLength); 886 &slow, kCheckMap, kDontIncrementLength);
882 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, 887 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
883 &slow, kDontCheckMap, kIncrementLength); 888 &slow, kDontCheckMap, kIncrementLength);
884 } 889 }
885 890
886 891
887 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { 892 void LoadIC::GenerateMegamorphic(MacroAssembler* masm, ExtraICState extra_state) {
888 // The return address is on the stack. 893 if (GetPropertyLookupMode(extra_state) == NORMAL_LOOKUP) {
889 Register receiver = ReceiverRegister(); 894 // The return address is on the stack.
890 Register name = NameRegister(); 895 Register receiver = ReceiverRegister();
891 DCHECK(receiver.is(edx)); 896 Register name = NameRegister();
892 DCHECK(name.is(ecx)); 897 DCHECK(receiver.is(edx));
898 DCHECK(name.is(ecx));
893 899
894 // Probe the stub cache. 900 // Probe the stub cache.
895 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( 901 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
896 Code::ComputeHandlerFlags(Code::LOAD_IC)); 902 Code::ComputeHandlerFlags(Code::LOAD_IC));
897 masm->isolate()->stub_cache()->GenerateProbe( 903 masm->isolate()->stub_cache()->GenerateProbe(
898 masm, flags, receiver, name, ebx, eax); 904 masm, flags, receiver, name, ebx, eax);
905 }
899 906
900 // Cache miss: Jump to runtime. 907 // Cache miss: Jump to runtime.
901 GenerateMiss(masm); 908 GenerateMiss(masm);
902 } 909 }
903 910
904 911
905 void LoadIC::GenerateNormal(MacroAssembler* masm) { 912 void LoadIC::GenerateNormal(MacroAssembler* masm) {
906 Register dictionary = eax; 913 Register dictionary = eax;
907 DCHECK(!dictionary.is(ReceiverRegister())); 914 DCHECK(!dictionary.is(ReceiverRegister()));
908 DCHECK(!dictionary.is(NameRegister())); 915 DCHECK(!dictionary.is(NameRegister()));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 955
949 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 956 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
950 // Return address is on the stack. 957 // Return address is on the stack.
951 LoadIC_PushArgs(masm); 958 LoadIC_PushArgs(masm);
952 959
953 // Perform tail call to the entry. 960 // Perform tail call to the entry.
954 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); 961 __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
955 } 962 }
956 963
957 964
965 void LoadIC::GenerateRuntimeGetOwnProperty(MacroAssembler* masm) {
966 // Return address is on the stack.
967 LoadIC_PushArgs(masm);
968
969 // Perform tail call to the entry.
970 __ TailCallRuntime(Runtime::kLoadOwnProperty, 2, 1);
971 }
972
973
958 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 974 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
959 // Return address is on the stack. 975 // Return address is on the stack.
960 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); 976 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1);
961 977
962 LoadIC_PushArgs(masm); 978 LoadIC_PushArgs(masm);
963 979
964 // Perform tail call to the entry. 980 // Perform tail call to the entry.
965 ExternalReference ref = 981 ExternalReference ref =
966 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); 982 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
967 __ TailCallExternalReference(ref, 2, 1); 983 __ TailCallExternalReference(ref, 2, 1);
(...skipping 29 matching lines...) Expand all
997 1013
998 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 1014 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
999 // Return address is on the stack. 1015 // Return address is on the stack.
1000 LoadIC_PushArgs(masm); 1016 LoadIC_PushArgs(masm);
1001 1017
1002 // Perform tail call to the entry. 1018 // Perform tail call to the entry.
1003 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); 1019 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
1004 } 1020 }
1005 1021
1006 1022
1023 void KeyedLoadIC::GenerateRuntimeGetOwnProperty(MacroAssembler* masm) {
1024 // Return address is on the stack.
1025 LoadIC_PushArgs(masm);
1026
1027 // Perform tail call to the entry.
1028 __ TailCallRuntime(Runtime::kKeyedGetOwnProperty, 2, 1);
1029 }
1030
1031
1007 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { 1032 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
1008 // Return address is on the stack. 1033 // Return address is on the stack.
1009 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( 1034 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
1010 Code::ComputeHandlerFlags(Code::STORE_IC)); 1035 Code::ComputeHandlerFlags(Code::STORE_IC));
1011 masm->isolate()->stub_cache()->GenerateProbe( 1036 masm->isolate()->stub_cache()->GenerateProbe(
1012 masm, flags, ReceiverRegister(), NameRegister(), 1037 masm, flags, ReceiverRegister(), NameRegister(),
1013 ebx, no_reg); 1038 ebx, no_reg);
1014 1039
1015 // Cache miss: Jump to runtime. 1040 // Cache miss: Jump to runtime.
1016 GenerateMiss(masm); 1041 GenerateMiss(masm);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) 1227 Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
1203 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 1228 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
1204 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 1229 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
1205 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1230 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1206 } 1231 }
1207 1232
1208 1233
1209 } } // namespace v8::internal 1234 } } // namespace v8::internal
1210 1235
1211 #endif // V8_TARGET_ARCH_IA32 1236 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698