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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 23619036: Reland "Clean up after r16292 (disable optimization for StringWrappers)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix bug Created 7 years, 3 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/x64/code-stubs-x64.cc ('k') | test/mjsunit/regress/regress-2855.js » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after
2928 } 2928 }
2929 2929
2930 2930
2931 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf( 2931 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
2932 CallRuntime* expr) { 2932 CallRuntime* expr) {
2933 ZoneList<Expression*>* args = expr->arguments(); 2933 ZoneList<Expression*>* args = expr->arguments();
2934 ASSERT(args->length() == 1); 2934 ASSERT(args->length() == 1);
2935 2935
2936 VisitForAccumulatorValue(args->at(0)); 2936 VisitForAccumulatorValue(args->at(0));
2937 2937
2938 Label materialize_true, materialize_false; 2938 Label materialize_true, materialize_false, skip_lookup;
2939 Label* if_true = NULL; 2939 Label* if_true = NULL;
2940 Label* if_false = NULL; 2940 Label* if_false = NULL;
2941 Label* fall_through = NULL; 2941 Label* fall_through = NULL;
2942 context()->PrepareTest(&materialize_true, &materialize_false, 2942 context()->PrepareTest(&materialize_true, &materialize_false,
2943 &if_true, &if_false, &fall_through); 2943 &if_true, &if_false, &fall_through);
2944 2944
2945 __ AssertNotSmi(rax); 2945 __ AssertNotSmi(rax);
2946 2946
2947 // Check whether this map has already been checked to be safe for default 2947 // Check whether this map has already been checked to be safe for default
2948 // valueOf. 2948 // valueOf.
2949 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); 2949 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset));
2950 __ testb(FieldOperand(rbx, Map::kBitField2Offset), 2950 __ testb(FieldOperand(rbx, Map::kBitField2Offset),
2951 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); 2951 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf));
2952 __ j(not_zero, if_true); 2952 __ j(not_zero, &skip_lookup);
2953 2953
2954 // Check for fast case object. Generate false result for slow case object. 2954 // Check for fast case object. Generate false result for slow case object.
2955 __ movq(rcx, FieldOperand(rax, JSObject::kPropertiesOffset)); 2955 __ movq(rcx, FieldOperand(rax, JSObject::kPropertiesOffset));
2956 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); 2956 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset));
2957 __ CompareRoot(rcx, Heap::kHashTableMapRootIndex); 2957 __ CompareRoot(rcx, Heap::kHashTableMapRootIndex);
2958 __ j(equal, if_false); 2958 __ j(equal, if_false);
2959 2959
2960 // Look for valueOf string in the descriptor array, and indicate false if 2960 // Look for valueOf string in the descriptor array, and indicate false if
2961 // found. Since we omit an enumeration index check, if it is added via a 2961 // found. Since we omit an enumeration index check, if it is added via a
2962 // transition that shares its descriptor array, this is a false positive. 2962 // transition that shares its descriptor array, this is a false positive.
2963 Label entry, loop, done; 2963 Label entry, loop, done;
2964 2964
2965 // Skip loop if no descriptors are valid. 2965 // Skip loop if no descriptors are valid.
2966 __ NumberOfOwnDescriptors(rcx, rbx); 2966 __ NumberOfOwnDescriptors(rcx, rbx);
2967 __ cmpq(rcx, Immediate(0)); 2967 __ cmpq(rcx, Immediate(0));
2968 __ j(equal, &done); 2968 __ j(equal, &done);
2969 2969
2970 __ LoadInstanceDescriptors(rbx, rbx); 2970 __ LoadInstanceDescriptors(rbx, r8);
2971 // rbx: descriptor array. 2971 // rbx: descriptor array.
2972 // rcx: valid entries in the descriptor array. 2972 // rcx: valid entries in the descriptor array.
2973 // Calculate the end of the descriptor array. 2973 // Calculate the end of the descriptor array.
2974 __ imul(rcx, rcx, Immediate(DescriptorArray::kDescriptorSize)); 2974 __ imul(rcx, rcx, Immediate(DescriptorArray::kDescriptorSize));
2975 SmiIndex index = masm_->SmiToIndex(rdx, rcx, kPointerSizeLog2); 2975 SmiIndex index = masm_->SmiToIndex(rdx, rcx, kPointerSizeLog2);
2976 __ lea(rcx, 2976 __ lea(rcx,
2977 Operand( 2977 Operand(
2978 rbx, index.reg, index.scale, DescriptorArray::kFirstOffset)); 2978 r8, index.reg, index.scale, DescriptorArray::kFirstOffset));
2979 // Calculate location of the first key name. 2979 // Calculate location of the first key name.
2980 __ addq(rbx, Immediate(DescriptorArray::kFirstOffset)); 2980 __ addq(r8, Immediate(DescriptorArray::kFirstOffset));
2981 // Loop through all the keys in the descriptor array. If one of these is the 2981 // Loop through all the keys in the descriptor array. If one of these is the
2982 // internalized string "valueOf" the result is false. 2982 // internalized string "valueOf" the result is false.
2983 __ jmp(&entry); 2983 __ jmp(&entry);
2984 __ bind(&loop); 2984 __ bind(&loop);
2985 __ movq(rdx, FieldOperand(rbx, 0)); 2985 __ movq(rdx, FieldOperand(r8, 0));
2986 __ Cmp(rdx, isolate()->factory()->value_of_string()); 2986 __ Cmp(rdx, isolate()->factory()->value_of_string());
2987 __ j(equal, if_false); 2987 __ j(equal, if_false);
2988 __ addq(rbx, Immediate(DescriptorArray::kDescriptorSize * kPointerSize)); 2988 __ addq(r8, Immediate(DescriptorArray::kDescriptorSize * kPointerSize));
2989 __ bind(&entry); 2989 __ bind(&entry);
2990 __ cmpq(rbx, rcx); 2990 __ cmpq(r8, rcx);
2991 __ j(not_equal, &loop); 2991 __ j(not_equal, &loop);
2992 2992
2993 __ bind(&done); 2993 __ bind(&done);
2994 // Reload map as register rbx was used as temporary above. 2994
2995 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); 2995 // Set the bit in the map to indicate that there is no local valueOf field.
2996 __ or_(FieldOperand(rbx, Map::kBitField2Offset),
2997 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf));
2998
2999 __ bind(&skip_lookup);
2996 3000
2997 // If a valueOf property is not found on the object check that its 3001 // If a valueOf property is not found on the object check that its
2998 // prototype is the un-modified String prototype. If not result is false. 3002 // prototype is the un-modified String prototype. If not result is false.
2999 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); 3003 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset));
3000 __ testq(rcx, Immediate(kSmiTagMask)); 3004 __ testq(rcx, Immediate(kSmiTagMask));
3001 __ j(zero, if_false); 3005 __ j(zero, if_false);
3002 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); 3006 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset));
3003 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 3007 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
3004 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); 3008 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset));
3005 __ cmpq(rcx, 3009 __ cmpq(rcx,
3006 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 3010 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
3007 __ j(not_equal, if_false); 3011 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
3008 __ jmp(if_true); 3012 Split(equal, if_true, if_false, fall_through);
3009 3013
3010 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
3011 context()->Plug(if_true, if_false); 3014 context()->Plug(if_true, if_false);
3012 } 3015 }
3013 3016
3014 3017
3015 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { 3018 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) {
3016 ZoneList<Expression*>* args = expr->arguments(); 3019 ZoneList<Expression*>* args = expr->arguments();
3017 ASSERT(args->length() == 1); 3020 ASSERT(args->length() == 1);
3018 3021
3019 VisitForAccumulatorValue(args->at(0)); 3022 VisitForAccumulatorValue(args->at(0));
3020 3023
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
4876 *context_length = 0; 4879 *context_length = 0;
4877 return previous_; 4880 return previous_;
4878 } 4881 }
4879 4882
4880 4883
4881 #undef __ 4884 #undef __
4882 4885
4883 } } // namespace v8::internal 4886 } } // namespace v8::internal
4884 4887
4885 #endif // V8_TARGET_ARCH_X64 4888 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | test/mjsunit/regress/regress-2855.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698