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

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

Issue 10878047: Revert to code state of 3.13.1 plus r12350 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 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/x64/deoptimizer-x64.cc ('k') | src/x64/lithium-codegen-x64.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 // 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 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 } 1278 }
1279 1279
1280 if (s != NULL && s->is_eval_scope()) { 1280 if (s != NULL && s->is_eval_scope()) {
1281 // Loop up the context chain. There is no frame effect so it is 1281 // Loop up the context chain. There is no frame effect so it is
1282 // safe to use raw labels here. 1282 // safe to use raw labels here.
1283 Label next, fast; 1283 Label next, fast;
1284 if (!context.is(temp)) { 1284 if (!context.is(temp)) {
1285 __ movq(temp, context); 1285 __ movq(temp, context);
1286 } 1286 }
1287 // Load map for comparison into register, outside loop. 1287 // Load map for comparison into register, outside loop.
1288 __ LoadRoot(kScratchRegister, Heap::kNativeContextMapRootIndex); 1288 __ LoadRoot(kScratchRegister, Heap::kGlobalContextMapRootIndex);
1289 __ bind(&next); 1289 __ bind(&next);
1290 // Terminate at native context. 1290 // Terminate at global context.
1291 __ cmpq(kScratchRegister, FieldOperand(temp, HeapObject::kMapOffset)); 1291 __ cmpq(kScratchRegister, FieldOperand(temp, HeapObject::kMapOffset));
1292 __ j(equal, &fast, Label::kNear); 1292 __ j(equal, &fast, Label::kNear);
1293 // Check that extension is NULL. 1293 // Check that extension is NULL.
1294 __ cmpq(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0)); 1294 __ cmpq(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0));
1295 __ j(not_equal, slow); 1295 __ j(not_equal, slow);
1296 // Load next context in chain. 1296 // Load next context in chain.
1297 __ movq(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); 1297 __ movq(temp, ContextOperand(temp, Context::PREVIOUS_INDEX));
1298 __ jmp(&next); 1298 __ jmp(&next);
1299 __ bind(&fast); 1299 __ bind(&fast);
1300 } 1300 }
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 2660
2661 // Reload map as register rbx was used as temporary above. 2661 // Reload map as register rbx was used as temporary above.
2662 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); 2662 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset));
2663 2663
2664 // If a valueOf property is not found on the object check that it's 2664 // If a valueOf property is not found on the object check that it's
2665 // prototype is the un-modified String prototype. If not result is false. 2665 // prototype is the un-modified String prototype. If not result is false.
2666 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); 2666 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset));
2667 __ testq(rcx, Immediate(kSmiTagMask)); 2667 __ testq(rcx, Immediate(kSmiTagMask));
2668 __ j(zero, if_false); 2668 __ j(zero, if_false);
2669 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); 2669 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset));
2670 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2670 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
2671 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); 2671 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset));
2672 __ cmpq(rcx, 2672 __ cmpq(rcx,
2673 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); 2673 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
2674 __ j(not_equal, if_false); 2674 __ j(not_equal, if_false);
2675 // Set the bit in the map to indicate that it has been checked safe for 2675 // Set the bit in the map to indicate that it has been checked safe for
2676 // default valueOf and set true result. 2676 // default valueOf and set true result.
2677 __ or_(FieldOperand(rbx, Map::kBitField2Offset), 2677 __ or_(FieldOperand(rbx, Map::kBitField2Offset),
2678 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); 2678 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf));
2679 __ jmp(if_true); 2679 __ jmp(if_true);
2680 2680
2681 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 2681 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 // Allocate a heap number. 2938 // Allocate a heap number.
2939 __ CallRuntime(Runtime::kNumberAlloc, 0); 2939 __ CallRuntime(Runtime::kNumberAlloc, 0);
2940 __ movq(rbx, rax); 2940 __ movq(rbx, rax);
2941 2941
2942 __ bind(&heapnumber_allocated); 2942 __ bind(&heapnumber_allocated);
2943 2943
2944 // Return a random uint32 number in rax. 2944 // Return a random uint32 number in rax.
2945 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. 2945 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs.
2946 __ PrepareCallCFunction(1); 2946 __ PrepareCallCFunction(1);
2947 #ifdef _WIN64 2947 #ifdef _WIN64
2948 __ movq(rcx, 2948 __ movq(rcx, ContextOperand(context_register(), Context::GLOBAL_INDEX));
2949 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); 2949 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
2950 __ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset));
2951 2950
2952 #else 2951 #else
2953 __ movq(rdi, 2952 __ movq(rdi, ContextOperand(context_register(), Context::GLOBAL_INDEX));
2954 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); 2953 __ movq(rdi, FieldOperand(rdi, GlobalObject::kGlobalContextOffset));
2955 __ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset));
2956 #endif 2954 #endif
2957 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); 2955 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
2958 2956
2959 // Convert 32 random bits in rax to 0.(32 random bits) in a double 2957 // Convert 32 random bits in rax to 0.(32 random bits) in a double
2960 // by computing: 2958 // by computing:
2961 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 2959 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
2962 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. 2960 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single.
2963 __ movd(xmm1, rcx); 2961 __ movd(xmm1, rcx);
2964 __ movd(xmm0, rax); 2962 __ movd(xmm0, rax);
2965 __ cvtss2sd(xmm1, xmm1); 2963 __ cvtss2sd(xmm1, xmm1);
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3362 3360
3363 3361
3364 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { 3362 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
3365 ZoneList<Expression*>* args = expr->arguments(); 3363 ZoneList<Expression*>* args = expr->arguments();
3366 ASSERT_EQ(2, args->length()); 3364 ASSERT_EQ(2, args->length());
3367 3365
3368 ASSERT_NE(NULL, args->at(0)->AsLiteral()); 3366 ASSERT_NE(NULL, args->at(0)->AsLiteral());
3369 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); 3367 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
3370 3368
3371 Handle<FixedArray> jsfunction_result_caches( 3369 Handle<FixedArray> jsfunction_result_caches(
3372 isolate()->native_context()->jsfunction_result_caches()); 3370 isolate()->global_context()->jsfunction_result_caches());
3373 if (jsfunction_result_caches->length() <= cache_id) { 3371 if (jsfunction_result_caches->length() <= cache_id) {
3374 __ Abort("Attempt to use undefined cache."); 3372 __ Abort("Attempt to use undefined cache.");
3375 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 3373 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
3376 context()->Plug(rax); 3374 context()->Plug(rax);
3377 return; 3375 return;
3378 } 3376 }
3379 3377
3380 VisitForAccumulatorValue(args->at(1)); 3378 VisitForAccumulatorValue(args->at(1));
3381 3379
3382 Register key = rax; 3380 Register key = rax;
3383 Register cache = rbx; 3381 Register cache = rbx;
3384 Register tmp = rcx; 3382 Register tmp = rcx;
3385 __ movq(cache, ContextOperand(rsi, Context::GLOBAL_OBJECT_INDEX)); 3383 __ movq(cache, ContextOperand(rsi, Context::GLOBAL_INDEX));
3386 __ movq(cache, 3384 __ movq(cache,
3387 FieldOperand(cache, GlobalObject::kNativeContextOffset)); 3385 FieldOperand(cache, GlobalObject::kGlobalContextOffset));
3388 __ movq(cache, 3386 __ movq(cache,
3389 ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); 3387 ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX));
3390 __ movq(cache, 3388 __ movq(cache,
3391 FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); 3389 FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id)));
3392 3390
3393 Label done, not_found; 3391 Label done, not_found;
3394 // tmp now holds finger offset as a smi. 3392 // tmp now holds finger offset as a smi.
3395 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); 3393 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1);
3396 __ movq(tmp, FieldOperand(cache, JSFunctionResultCache::kFingerOffset)); 3394 __ movq(tmp, FieldOperand(cache, JSFunctionResultCache::kFingerOffset));
3397 SmiIndex index = 3395 SmiIndex index =
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
4424 4422
4425 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 4423 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
4426 __ movq(dst, ContextOperand(rsi, context_index)); 4424 __ movq(dst, ContextOperand(rsi, context_index));
4427 } 4425 }
4428 4426
4429 4427
4430 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 4428 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
4431 Scope* declaration_scope = scope()->DeclarationScope(); 4429 Scope* declaration_scope = scope()->DeclarationScope();
4432 if (declaration_scope->is_global_scope() || 4430 if (declaration_scope->is_global_scope() ||
4433 declaration_scope->is_module_scope()) { 4431 declaration_scope->is_module_scope()) {
4434 // Contexts nested in the native context have a canonical empty function 4432 // Contexts nested in the global context have a canonical empty function
4435 // as their closure, not the anonymous closure containing the global 4433 // as their closure, not the anonymous closure containing the global
4436 // code. Pass a smi sentinel and let the runtime look up the empty 4434 // code. Pass a smi sentinel and let the runtime look up the empty
4437 // function. 4435 // function.
4438 __ Push(Smi::FromInt(0)); 4436 __ Push(Smi::FromInt(0));
4439 } else if (declaration_scope->is_eval_scope()) { 4437 } else if (declaration_scope->is_eval_scope()) {
4440 // Contexts created by a call to eval have the same closure as the 4438 // Contexts created by a call to eval have the same closure as the
4441 // context calling eval, not the anonymous closure containing the eval 4439 // context calling eval, not the anonymous closure containing the eval
4442 // code. Fetch it from the context. 4440 // code. Fetch it from the context.
4443 __ push(ContextOperand(rsi, Context::CLOSURE_INDEX)); 4441 __ push(ContextOperand(rsi, Context::CLOSURE_INDEX));
4444 } else { 4442 } else {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4542 *context_length = 0; 4540 *context_length = 0;
4543 return previous_; 4541 return previous_;
4544 } 4542 }
4545 4543
4546 4544
4547 #undef __ 4545 #undef __
4548 4546
4549 } } // namespace v8::internal 4547 } } // namespace v8::internal
4550 4548
4551 #endif // V8_TARGET_ARCH_X64 4549 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698