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

Side by Side Diff: src/x87/full-codegen-x87.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, 7 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/full-codegen-x64.cc ('k') | no next file » | 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_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "code-stubs.h" 9 #include "code-stubs.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 2191
2192 // Only the value field needs a write barrier, as the other values are in the 2192 // Only the value field needs a write barrier, as the other values are in the
2193 // root set. 2193 // root set.
2194 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, 2194 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset,
2195 ecx, edx); 2195 ecx, edx);
2196 } 2196 }
2197 2197
2198 2198
2199 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2199 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2200 SetSourcePosition(prop->position()); 2200 SetSourcePosition(prop->position());
2201 Literal* key = prop->key()->AsLiteral(); 2201 Literal* key = prop->key()->AsStringLiteral();
2202 ASSERT(!key->value()->IsSmi()); 2202 ASSERT(!key->value()->IsSmi());
2203 __ mov(ecx, Immediate(key->value())); 2203 __ mov(ecx, Immediate(key->value()));
2204 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); 2204 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
2205 } 2205 }
2206 2206
2207 2207
2208 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2208 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2209 SetSourcePosition(prop->position()); 2209 SetSourcePosition(prop->position());
2210 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 2210 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
2211 CallIC(ic, prop->PropertyFeedbackId()); 2211 CallIC(ic, prop->PropertyFeedbackId());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 Variable* var = expr->AsVariableProxy()->var(); 2338 Variable* var = expr->AsVariableProxy()->var();
2339 EffectContext context(this); 2339 EffectContext context(this);
2340 EmitVariableAssignment(var, Token::ASSIGN); 2340 EmitVariableAssignment(var, Token::ASSIGN);
2341 break; 2341 break;
2342 } 2342 }
2343 case NAMED_PROPERTY: { 2343 case NAMED_PROPERTY: {
2344 __ push(eax); // Preserve value. 2344 __ push(eax); // Preserve value.
2345 VisitForAccumulatorValue(prop->obj()); 2345 VisitForAccumulatorValue(prop->obj());
2346 __ mov(edx, eax); 2346 __ mov(edx, eax);
2347 __ pop(eax); // Restore value. 2347 __ pop(eax); // Restore value.
2348 __ mov(ecx, prop->key()->AsLiteral()->value()); 2348 __ mov(ecx, prop->key()->AsStringLiteral()->value());
2349 CallStoreIC(); 2349 CallStoreIC();
2350 break; 2350 break;
2351 } 2351 }
2352 case KEYED_PROPERTY: { 2352 case KEYED_PROPERTY: {
2353 __ push(eax); // Preserve value. 2353 __ push(eax); // Preserve value.
2354 VisitForStackValue(prop->obj()); 2354 VisitForStackValue(prop->obj());
2355 VisitForAccumulatorValue(prop->key()); 2355 VisitForAccumulatorValue(prop->key());
2356 __ mov(ecx, eax); 2356 __ mov(ecx, eax);
2357 __ pop(edx); // Receiver. 2357 __ pop(edx); // Receiver.
2358 __ pop(eax); // Restore value. 2358 __ pop(eax); // Restore value.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 } 2453 }
2454 2454
2455 2455
2456 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2456 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2457 // Assignment to a property, using a named store IC. 2457 // Assignment to a property, using a named store IC.
2458 // eax : value 2458 // eax : value
2459 // esp[0] : receiver 2459 // esp[0] : receiver
2460 2460
2461 Property* prop = expr->target()->AsProperty(); 2461 Property* prop = expr->target()->AsProperty();
2462 ASSERT(prop != NULL); 2462 ASSERT(prop != NULL);
2463 ASSERT(prop->key()->AsLiteral() != NULL); 2463 ASSERT(prop->key()->AsStringLiteral() != NULL);
2464 2464
2465 // Record source code position before IC call. 2465 // Record source code position before IC call.
2466 SetSourcePosition(expr->position()); 2466 SetSourcePosition(expr->position());
2467 __ mov(ecx, prop->key()->AsLiteral()->value()); 2467 __ mov(ecx, prop->key()->AsStringLiteral()->value());
2468 __ pop(edx); 2468 __ pop(edx);
2469 CallStoreIC(expr->AssignmentFeedbackId()); 2469 CallStoreIC(expr->AssignmentFeedbackId());
2470 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2470 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2471 context()->Plug(eax); 2471 context()->Plug(eax);
2472 } 2472 }
2473 2473
2474 2474
2475 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2475 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2476 // Assignment to a property, using a keyed store IC. 2476 // Assignment to a property, using a keyed store IC.
2477 // eax : value 2477 // eax : value
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); 3284 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset));
3285 3285
3286 __ bind(&done); 3286 __ bind(&done);
3287 context()->Plug(eax); 3287 context()->Plug(eax);
3288 } 3288 }
3289 3289
3290 3290
3291 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3291 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3292 ZoneList<Expression*>* args = expr->arguments(); 3292 ZoneList<Expression*>* args = expr->arguments();
3293 ASSERT(args->length() == 2); 3293 ASSERT(args->length() == 2);
3294 ASSERT_NE(NULL, args->at(1)->AsLiteral()); 3294 ASSERT_NE(NULL, args->at(1)->AsNumberLiteral());
3295 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); 3295 Smi* index = Smi::cast(*(args->at(1)->AsNumberLiteral()->value()));
3296 3296
3297 VisitForAccumulatorValue(args->at(0)); // Load the object. 3297 VisitForAccumulatorValue(args->at(0)); // Load the object.
3298 3298
3299 Label runtime, done, not_date_object; 3299 Label runtime, done, not_date_object;
3300 Register object = eax; 3300 Register object = eax;
3301 Register result = eax; 3301 Register result = eax;
3302 Register scratch = ecx; 3302 Register scratch = ecx;
3303 3303
3304 __ JumpIfSmi(object, &not_date_object); 3304 __ JumpIfSmi(object, &not_date_object);
3305 __ CmpObjectType(object, JS_DATE_TYPE, scratch); 3305 __ CmpObjectType(object, JS_DATE_TYPE, scratch);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
3639 __ pop(ecx); 3639 __ pop(ecx);
3640 __ CallStub(&stub); 3640 __ CallStub(&stub);
3641 context()->Plug(eax); 3641 context()->Plug(eax);
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 __ mov(eax, isolate()->factory()->undefined_value()); 3656 __ mov(eax, isolate()->factory()->undefined_value());
3657 context()->Plug(eax); 3657 context()->Plug(eax);
3658 return; 3658 return;
3659 } 3659 }
3660 3660
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
4309 } 4309 }
4310 } else { 4310 } else {
4311 // Perform the assignment as if via '='. 4311 // Perform the assignment as if via '='.
4312 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4312 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4313 Token::ASSIGN); 4313 Token::ASSIGN);
4314 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4314 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4315 context()->Plug(eax); 4315 context()->Plug(eax);
4316 } 4316 }
4317 break; 4317 break;
4318 case NAMED_PROPERTY: { 4318 case NAMED_PROPERTY: {
4319 __ mov(ecx, prop->key()->AsLiteral()->value()); 4319 __ mov(ecx, prop->key()->AsStringLiteral()->value());
4320 __ pop(edx); 4320 __ pop(edx);
4321 CallStoreIC(expr->CountStoreFeedbackId()); 4321 CallStoreIC(expr->CountStoreFeedbackId());
4322 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4322 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4323 if (expr->is_postfix()) { 4323 if (expr->is_postfix()) {
4324 if (!context()->IsEffect()) { 4324 if (!context()->IsEffect()) {
4325 context()->PlugTOS(); 4325 context()->PlugTOS();
4326 } 4326 }
4327 } else { 4327 } else {
4328 context()->Plug(eax); 4328 context()->Plug(eax);
4329 } 4329 }
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
4786 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4786 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4787 Assembler::target_address_at(call_target_address, 4787 Assembler::target_address_at(call_target_address,
4788 unoptimized_code)); 4788 unoptimized_code));
4789 return OSR_AFTER_STACK_CHECK; 4789 return OSR_AFTER_STACK_CHECK;
4790 } 4790 }
4791 4791
4792 4792
4793 } } // namespace v8::internal 4793 } } // namespace v8::internal
4794 4794
4795 #endif // V8_TARGET_ARCH_X87 4795 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698