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

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

Issue 300103005: Split StringLiteral from Literal. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: number literals Created 6 years, 6 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/typing.cc ('k') | src/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 #include "v8.h" 5 #include "v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "code-stubs.h" 9 #include "code-stubs.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 2235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 2246
2247 // Only the value field needs a write barrier, as the other values are in the 2247 // Only the value field needs a write barrier, as the other values are in the
2248 // root set. 2248 // root set.
2249 __ RecordWriteField(rax, JSGeneratorObject::kResultValuePropertyOffset, 2249 __ RecordWriteField(rax, JSGeneratorObject::kResultValuePropertyOffset,
2250 rcx, rdx, kDontSaveFPRegs); 2250 rcx, rdx, kDontSaveFPRegs);
2251 } 2251 }
2252 2252
2253 2253
2254 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2254 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2255 SetSourcePosition(prop->position()); 2255 SetSourcePosition(prop->position());
2256 Literal* key = prop->key()->AsLiteral(); 2256 Literal* key = prop->key()->AsStringLiteral();
2257 __ Move(rcx, key->value()); 2257 __ Move(rcx, key->value());
2258 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); 2258 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
2259 } 2259 }
2260 2260
2261 2261
2262 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2262 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2263 SetSourcePosition(prop->position()); 2263 SetSourcePosition(prop->position());
2264 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 2264 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
2265 CallIC(ic, prop->PropertyFeedbackId()); 2265 CallIC(ic, prop->PropertyFeedbackId());
2266 } 2266 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 Variable* var = expr->AsVariableProxy()->var(); 2358 Variable* var = expr->AsVariableProxy()->var();
2359 EffectContext context(this); 2359 EffectContext context(this);
2360 EmitVariableAssignment(var, Token::ASSIGN); 2360 EmitVariableAssignment(var, Token::ASSIGN);
2361 break; 2361 break;
2362 } 2362 }
2363 case NAMED_PROPERTY: { 2363 case NAMED_PROPERTY: {
2364 __ Push(rax); // Preserve value. 2364 __ Push(rax); // Preserve value.
2365 VisitForAccumulatorValue(prop->obj()); 2365 VisitForAccumulatorValue(prop->obj());
2366 __ movp(rdx, rax); 2366 __ movp(rdx, rax);
2367 __ Pop(rax); // Restore value. 2367 __ Pop(rax); // Restore value.
2368 __ Move(rcx, prop->key()->AsLiteral()->value()); 2368 __ Move(rcx, prop->key()->AsStringLiteral()->value());
2369 CallStoreIC(); 2369 CallStoreIC();
2370 break; 2370 break;
2371 } 2371 }
2372 case KEYED_PROPERTY: { 2372 case KEYED_PROPERTY: {
2373 __ Push(rax); // Preserve value. 2373 __ Push(rax); // Preserve value.
2374 VisitForStackValue(prop->obj()); 2374 VisitForStackValue(prop->obj());
2375 VisitForAccumulatorValue(prop->key()); 2375 VisitForAccumulatorValue(prop->key());
2376 __ movp(rcx, rax); 2376 __ movp(rcx, rax);
2377 __ Pop(rdx); 2377 __ Pop(rdx);
2378 __ Pop(rax); // Restore value. 2378 __ Pop(rax); // Restore value.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 } 2470 }
2471 } 2471 }
2472 // Non-initializing assignments to consts are ignored. 2472 // Non-initializing assignments to consts are ignored.
2473 } 2473 }
2474 2474
2475 2475
2476 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2476 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2477 // Assignment to a property, using a named store IC. 2477 // Assignment to a property, using a named store IC.
2478 Property* prop = expr->target()->AsProperty(); 2478 Property* prop = expr->target()->AsProperty();
2479 ASSERT(prop != NULL); 2479 ASSERT(prop != NULL);
2480 ASSERT(prop->key()->AsLiteral() != NULL); 2480 ASSERT(prop->key()->AsStringLiteral() != NULL);
2481 2481
2482 // Record source code position before IC call. 2482 // Record source code position before IC call.
2483 SetSourcePosition(expr->position()); 2483 SetSourcePosition(expr->position());
2484 __ Move(rcx, prop->key()->AsLiteral()->value()); 2484 __ Move(rcx, prop->key()->AsStringLiteral()->value());
2485 __ Pop(rdx); 2485 __ Pop(rdx);
2486 CallStoreIC(expr->AssignmentFeedbackId()); 2486 CallStoreIC(expr->AssignmentFeedbackId());
2487 2487
2488 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2488 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2489 context()->Plug(rax); 2489 context()->Plug(rax);
2490 } 2490 }
2491 2491
2492 2492
2493 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2493 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2494 // Assignment to a property, using a keyed store IC. 2494 // Assignment to a property, using a keyed store IC.
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
3287 __ movp(rax, FieldOperand(rax, JSValue::kValueOffset)); 3287 __ movp(rax, FieldOperand(rax, JSValue::kValueOffset));
3288 3288
3289 __ bind(&done); 3289 __ bind(&done);
3290 context()->Plug(rax); 3290 context()->Plug(rax);
3291 } 3291 }
3292 3292
3293 3293
3294 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3294 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3295 ZoneList<Expression*>* args = expr->arguments(); 3295 ZoneList<Expression*>* args = expr->arguments();
3296 ASSERT(args->length() == 2); 3296 ASSERT(args->length() == 2);
3297 ASSERT_NE(NULL, args->at(1)->AsLiteral()); 3297 ASSERT_NE(NULL, args->at(1)->AsNumberLiteral());
3298 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); 3298 Smi* index = Smi::cast(*(args->at(1)->AsNumberLiteral()->value()));
3299 3299
3300 VisitForAccumulatorValue(args->at(0)); // Load the object. 3300 VisitForAccumulatorValue(args->at(0)); // Load the object.
3301 3301
3302 Label runtime, done, not_date_object; 3302 Label runtime, done, not_date_object;
3303 Register object = rax; 3303 Register object = rax;
3304 Register result = rax; 3304 Register result = rax;
3305 Register scratch = rcx; 3305 Register scratch = rcx;
3306 3306
3307 __ JumpIfSmi(object, &not_date_object); 3307 __ JumpIfSmi(object, &not_date_object);
3308 __ CmpObjectType(object, JS_DATE_TYPE, scratch); 3308 __ CmpObjectType(object, JS_DATE_TYPE, scratch);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3639 __ Pop(rcx); 3639 __ Pop(rcx);
3640 __ CallStub(&stub); 3640 __ CallStub(&stub);
3641 context()->Plug(rax); 3641 context()->Plug(rax);
3642 } 3642 }
3643 3643
3644 3644
3645 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { 3645 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
3646 ZoneList<Expression*>* args = expr->arguments(); 3646 ZoneList<Expression*>* args = expr->arguments();
3647 ASSERT_EQ(2, args->length()); 3647 ASSERT_EQ(2, args->length());
3648 3648
3649 ASSERT_NE(NULL, args->at(0)->AsLiteral()); 3649 ASSERT_NE(NULL, args->at(0)->AsNumberLiteral());
3650 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value(); 3650 int cache_id = Smi::cast(*(args->at(0)->AsNumberLiteral()->value()))->value();
3651 3651
3652 Handle<FixedArray> jsfunction_result_caches( 3652 Handle<FixedArray> jsfunction_result_caches(
3653 isolate()->native_context()->jsfunction_result_caches()); 3653 isolate()->native_context()->jsfunction_result_caches());
3654 if (jsfunction_result_caches->length() <= cache_id) { 3654 if (jsfunction_result_caches->length() <= cache_id) {
3655 __ Abort(kAttemptToUseUndefinedCache); 3655 __ Abort(kAttemptToUseUndefinedCache);
3656 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 3656 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
3657 context()->Plug(rax); 3657 context()->Plug(rax);
3658 return; 3658 return;
3659 } 3659 }
3660 3660
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 } 4331 }
4332 } else { 4332 } else {
4333 // Perform the assignment as if via '='. 4333 // Perform the assignment as if via '='.
4334 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4334 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4335 Token::ASSIGN); 4335 Token::ASSIGN);
4336 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4336 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4337 context()->Plug(rax); 4337 context()->Plug(rax);
4338 } 4338 }
4339 break; 4339 break;
4340 case NAMED_PROPERTY: { 4340 case NAMED_PROPERTY: {
4341 __ Move(rcx, prop->key()->AsLiteral()->value()); 4341 __ Move(rcx, prop->key()->AsStringLiteral()->value());
4342 __ Pop(rdx); 4342 __ Pop(rdx);
4343 CallStoreIC(expr->CountStoreFeedbackId()); 4343 CallStoreIC(expr->CountStoreFeedbackId());
4344 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4344 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4345 if (expr->is_postfix()) { 4345 if (expr->is_postfix()) {
4346 if (!context()->IsEffect()) { 4346 if (!context()->IsEffect()) {
4347 context()->PlugTOS(); 4347 context()->PlugTOS();
4348 } 4348 }
4349 } else { 4349 } else {
4350 context()->Plug(rax); 4350 context()->Plug(rax);
4351 } 4351 }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
4810 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4810 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4811 Assembler::target_address_at(call_target_address, 4811 Assembler::target_address_at(call_target_address,
4812 unoptimized_code)); 4812 unoptimized_code));
4813 return OSR_AFTER_STACK_CHECK; 4813 return OSR_AFTER_STACK_CHECK;
4814 } 4814 }
4815 4815
4816 4816
4817 } } // namespace v8::internal 4817 } } // namespace v8::internal
4818 4818
4819 #endif // V8_TARGET_ARCH_X64 4819 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/typing.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698