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

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

Issue 1336273002: [builtins] Remove STRING_ADD_LEFT and STRING_ADD_RIGHT builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3236 3236
3237 __ JumpIfSmi(rax, if_false); 3237 __ JumpIfSmi(rax, if_false);
3238 __ CmpObjectType(rax, SIMD128_VALUE_TYPE, rbx); 3238 __ CmpObjectType(rax, SIMD128_VALUE_TYPE, rbx);
3239 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 3239 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
3240 Split(equal, if_true, if_false, fall_through); 3240 Split(equal, if_true, if_false, fall_through);
3241 3241
3242 context()->Plug(if_true, if_false); 3242 context()->Plug(if_true, if_false);
3243 } 3243 }
3244 3244
3245 3245
3246 void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
3247 CallRuntime* expr) {
3248 ZoneList<Expression*>* args = expr->arguments();
3249 DCHECK(args->length() == 1);
3250
3251 VisitForAccumulatorValue(args->at(0));
3252
3253 Label materialize_true, materialize_false, skip_lookup;
3254 Label* if_true = NULL;
3255 Label* if_false = NULL;
3256 Label* fall_through = NULL;
3257 context()->PrepareTest(&materialize_true, &materialize_false,
3258 &if_true, &if_false, &fall_through);
3259
3260 __ AssertNotSmi(rax);
3261
3262 // Check whether this map has already been checked to be safe for default
3263 // valueOf.
3264 __ movp(rbx, FieldOperand(rax, HeapObject::kMapOffset));
3265 __ testb(FieldOperand(rbx, Map::kBitField2Offset),
3266 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf));
3267 __ j(not_zero, &skip_lookup);
3268
3269 // Check for fast case object. Generate false result for slow case object.
3270 __ movp(rcx, FieldOperand(rax, JSObject::kPropertiesOffset));
3271 __ movp(rcx, FieldOperand(rcx, HeapObject::kMapOffset));
3272 __ CompareRoot(rcx, Heap::kHashTableMapRootIndex);
3273 __ j(equal, if_false);
3274
3275 // Look for valueOf string in the descriptor array, and indicate false if
3276 // found. Since we omit an enumeration index check, if it is added via a
3277 // transition that shares its descriptor array, this is a false positive.
3278 Label entry, loop, done;
3279
3280 // Skip loop if no descriptors are valid.
3281 __ NumberOfOwnDescriptors(rcx, rbx);
3282 __ cmpp(rcx, Immediate(0));
3283 __ j(equal, &done);
3284
3285 __ LoadInstanceDescriptors(rbx, r8);
3286 // rbx: descriptor array.
3287 // rcx: valid entries in the descriptor array.
3288 // Calculate the end of the descriptor array.
3289 __ imulp(rcx, rcx, Immediate(DescriptorArray::kDescriptorSize));
3290 __ leap(rcx,
3291 Operand(r8, rcx, times_pointer_size, DescriptorArray::kFirstOffset));
3292 // Calculate location of the first key name.
3293 __ addp(r8, Immediate(DescriptorArray::kFirstOffset));
3294 // Loop through all the keys in the descriptor array. If one of these is the
3295 // internalized string "valueOf" the result is false.
3296 __ jmp(&entry);
3297 __ bind(&loop);
3298 __ movp(rdx, FieldOperand(r8, 0));
3299 __ CompareRoot(rdx, Heap::kvalueOf_stringRootIndex);
3300 __ j(equal, if_false);
3301 __ addp(r8, Immediate(DescriptorArray::kDescriptorSize * kPointerSize));
3302 __ bind(&entry);
3303 __ cmpp(r8, rcx);
3304 __ j(not_equal, &loop);
3305
3306 __ bind(&done);
3307
3308 // Set the bit in the map to indicate that there is no local valueOf field.
3309 __ orp(FieldOperand(rbx, Map::kBitField2Offset),
3310 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf));
3311
3312 __ bind(&skip_lookup);
3313
3314 // If a valueOf property is not found on the object check that its
3315 // prototype is the un-modified String prototype. If not result is false.
3316 __ movp(rcx, FieldOperand(rbx, Map::kPrototypeOffset));
3317 __ testp(rcx, Immediate(kSmiTagMask));
3318 __ j(zero, if_false);
3319 __ movp(rcx, FieldOperand(rcx, HeapObject::kMapOffset));
3320 __ movp(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
3321 __ movp(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset));
3322 __ cmpp(rcx,
3323 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
3324 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
3325 Split(equal, if_true, if_false, fall_through);
3326
3327 context()->Plug(if_true, if_false);
3328 }
3329
3330
3331 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { 3246 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) {
3332 ZoneList<Expression*>* args = expr->arguments(); 3247 ZoneList<Expression*>* args = expr->arguments();
3333 DCHECK(args->length() == 1); 3248 DCHECK(args->length() == 1);
3334 3249
3335 VisitForAccumulatorValue(args->at(0)); 3250 VisitForAccumulatorValue(args->at(0));
3336 3251
3337 Label materialize_true, materialize_false; 3252 Label materialize_true, materialize_false;
3338 Label* if_true = NULL; 3253 Label* if_true = NULL;
3339 Label* if_false = NULL; 3254 Label* if_false = NULL;
3340 Label* fall_through = NULL; 3255 Label* fall_through = NULL;
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after
5289 Assembler::target_address_at(call_target_address, 5204 Assembler::target_address_at(call_target_address,
5290 unoptimized_code)); 5205 unoptimized_code));
5291 return OSR_AFTER_STACK_CHECK; 5206 return OSR_AFTER_STACK_CHECK;
5292 } 5207 }
5293 5208
5294 5209
5295 } // namespace internal 5210 } // namespace internal
5296 } // namespace v8 5211 } // namespace v8
5297 5212
5298 #endif // V8_TARGET_ARCH_X64 5213 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698