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

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

Issue 17576005: Rename Literal::handle to Literal::value (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/hydrogen.cc ('k') | src/parser.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 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 __ push(eax); // Save result on the stack 1632 __ push(eax); // Save result on the stack
1633 result_saved = true; 1633 result_saved = true;
1634 } 1634 }
1635 switch (property->kind()) { 1635 switch (property->kind()) {
1636 case ObjectLiteral::Property::CONSTANT: 1636 case ObjectLiteral::Property::CONSTANT:
1637 UNREACHABLE(); 1637 UNREACHABLE();
1638 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1638 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1639 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); 1639 ASSERT(!CompileTimeValue::IsCompileTimeValue(value));
1640 // Fall through. 1640 // Fall through.
1641 case ObjectLiteral::Property::COMPUTED: 1641 case ObjectLiteral::Property::COMPUTED:
1642 if (key->handle()->IsInternalizedString()) { 1642 if (key->value()->IsInternalizedString()) {
1643 if (property->emit_store()) { 1643 if (property->emit_store()) {
1644 VisitForAccumulatorValue(value); 1644 VisitForAccumulatorValue(value);
1645 __ mov(ecx, Immediate(key->handle())); 1645 __ mov(ecx, Immediate(key->value()));
1646 __ mov(edx, Operand(esp, 0)); 1646 __ mov(edx, Operand(esp, 0));
1647 Handle<Code> ic = is_classic_mode() 1647 Handle<Code> ic = is_classic_mode()
1648 ? isolate()->builtins()->StoreIC_Initialize() 1648 ? isolate()->builtins()->StoreIC_Initialize()
1649 : isolate()->builtins()->StoreIC_Initialize_Strict(); 1649 : isolate()->builtins()->StoreIC_Initialize_Strict();
1650 CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId()); 1650 CallIC(ic, RelocInfo::CODE_TARGET, key->LiteralFeedbackId());
1651 PrepareForBailoutForId(key->id(), NO_REGISTERS); 1651 PrepareForBailoutForId(key->id(), NO_REGISTERS);
1652 } else { 1652 } else {
1653 VisitForEffect(value); 1653 VisitForEffect(value);
1654 } 1654 }
1655 break; 1655 break;
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 // Only the value field needs a write barrier, as the other values are in the 2214 // Only the value field needs a write barrier, as the other values are in the
2215 // root set. 2215 // root set.
2216 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, 2216 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset,
2217 ecx, edx, kDontSaveFPRegs); 2217 ecx, edx, kDontSaveFPRegs);
2218 } 2218 }
2219 2219
2220 2220
2221 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2221 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2222 SetSourcePosition(prop->position()); 2222 SetSourcePosition(prop->position());
2223 Literal* key = prop->key()->AsLiteral(); 2223 Literal* key = prop->key()->AsLiteral();
2224 ASSERT(!key->handle()->IsSmi()); 2224 ASSERT(!key->value()->IsSmi());
2225 __ mov(ecx, Immediate(key->handle())); 2225 __ mov(ecx, Immediate(key->value()));
2226 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2226 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2227 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); 2227 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
2228 } 2228 }
2229 2229
2230 2230
2231 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2231 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2232 SetSourcePosition(prop->position()); 2232 SetSourcePosition(prop->position());
2233 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 2233 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
2234 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId()); 2234 CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
2235 } 2235 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 Variable* var = expr->AsVariableProxy()->var(); 2369 Variable* var = expr->AsVariableProxy()->var();
2370 EffectContext context(this); 2370 EffectContext context(this);
2371 EmitVariableAssignment(var, Token::ASSIGN); 2371 EmitVariableAssignment(var, Token::ASSIGN);
2372 break; 2372 break;
2373 } 2373 }
2374 case NAMED_PROPERTY: { 2374 case NAMED_PROPERTY: {
2375 __ push(eax); // Preserve value. 2375 __ push(eax); // Preserve value.
2376 VisitForAccumulatorValue(prop->obj()); 2376 VisitForAccumulatorValue(prop->obj());
2377 __ mov(edx, eax); 2377 __ mov(edx, eax);
2378 __ pop(eax); // Restore value. 2378 __ pop(eax); // Restore value.
2379 __ mov(ecx, prop->key()->AsLiteral()->handle()); 2379 __ mov(ecx, prop->key()->AsLiteral()->value());
2380 Handle<Code> ic = is_classic_mode() 2380 Handle<Code> ic = is_classic_mode()
2381 ? isolate()->builtins()->StoreIC_Initialize() 2381 ? isolate()->builtins()->StoreIC_Initialize()
2382 : isolate()->builtins()->StoreIC_Initialize_Strict(); 2382 : isolate()->builtins()->StoreIC_Initialize_Strict();
2383 CallIC(ic); 2383 CallIC(ic);
2384 break; 2384 break;
2385 } 2385 }
2386 case KEYED_PROPERTY: { 2386 case KEYED_PROPERTY: {
2387 __ push(eax); // Preserve value. 2387 __ push(eax); // Preserve value.
2388 VisitForStackValue(prop->obj()); 2388 VisitForStackValue(prop->obj());
2389 VisitForAccumulatorValue(prop->key()); 2389 VisitForAccumulatorValue(prop->key());
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 // Assignment to a property, using a named store IC. 2496 // Assignment to a property, using a named store IC.
2497 // eax : value 2497 // eax : value
2498 // esp[0] : receiver 2498 // esp[0] : receiver
2499 2499
2500 Property* prop = expr->target()->AsProperty(); 2500 Property* prop = expr->target()->AsProperty();
2501 ASSERT(prop != NULL); 2501 ASSERT(prop != NULL);
2502 ASSERT(prop->key()->AsLiteral() != NULL); 2502 ASSERT(prop->key()->AsLiteral() != NULL);
2503 2503
2504 // Record source code position before IC call. 2504 // Record source code position before IC call.
2505 SetSourcePosition(expr->position()); 2505 SetSourcePosition(expr->position());
2506 __ mov(ecx, prop->key()->AsLiteral()->handle()); 2506 __ mov(ecx, prop->key()->AsLiteral()->value());
2507 __ pop(edx); 2507 __ pop(edx);
2508 Handle<Code> ic = is_classic_mode() 2508 Handle<Code> ic = is_classic_mode()
2509 ? isolate()->builtins()->StoreIC_Initialize() 2509 ? isolate()->builtins()->StoreIC_Initialize()
2510 : isolate()->builtins()->StoreIC_Initialize_Strict(); 2510 : isolate()->builtins()->StoreIC_Initialize_Strict();
2511 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); 2511 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId());
2512 2512
2513 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2513 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2514 context()->Plug(eax); 2514 context()->Plug(eax);
2515 } 2515 }
2516 2516
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 // LoadContextSlot. That object could be the hole if the receiver is 2761 // LoadContextSlot. That object could be the hole if the receiver is
2762 // implicitly the global object. 2762 // implicitly the global object.
2763 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT); 2763 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT);
2764 2764
2765 } else if (property != NULL) { 2765 } else if (property != NULL) {
2766 { PreservePositionScope scope(masm()->positions_recorder()); 2766 { PreservePositionScope scope(masm()->positions_recorder());
2767 VisitForStackValue(property->obj()); 2767 VisitForStackValue(property->obj());
2768 } 2768 }
2769 if (property->key()->IsPropertyName()) { 2769 if (property->key()->IsPropertyName()) {
2770 EmitCallWithIC(expr, 2770 EmitCallWithIC(expr,
2771 property->key()->AsLiteral()->handle(), 2771 property->key()->AsLiteral()->value(),
2772 RelocInfo::CODE_TARGET); 2772 RelocInfo::CODE_TARGET);
2773 } else { 2773 } else {
2774 EmitKeyedCallWithIC(expr, property->key()); 2774 EmitKeyedCallWithIC(expr, property->key());
2775 } 2775 }
2776 2776
2777 } else { 2777 } else {
2778 // Call to an arbitrary expression not handled specially above. 2778 // Call to an arbitrary expression not handled specially above.
2779 { PreservePositionScope scope(masm()->positions_recorder()); 2779 { PreservePositionScope scope(masm()->positions_recorder());
2780 VisitForStackValue(callee); 2780 VisitForStackValue(callee);
2781 } 2781 }
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
3379 3379
3380 __ bind(&done); 3380 __ bind(&done);
3381 context()->Plug(eax); 3381 context()->Plug(eax);
3382 } 3382 }
3383 3383
3384 3384
3385 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3385 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3386 ZoneList<Expression*>* args = expr->arguments(); 3386 ZoneList<Expression*>* args = expr->arguments();
3387 ASSERT(args->length() == 2); 3387 ASSERT(args->length() == 2);
3388 ASSERT_NE(NULL, args->at(1)->AsLiteral()); 3388 ASSERT_NE(NULL, args->at(1)->AsLiteral());
3389 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle())); 3389 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
3390 3390
3391 VisitForAccumulatorValue(args->at(0)); // Load the object. 3391 VisitForAccumulatorValue(args->at(0)); // Load the object.
3392 3392
3393 Label runtime, done, not_date_object; 3393 Label runtime, done, not_date_object;
3394 Register object = eax; 3394 Register object = eax;
3395 Register result = eax; 3395 Register result = eax;
3396 Register scratch = ecx; 3396 Register scratch = ecx;
3397 3397
3398 __ JumpIfSmi(object, &not_date_object); 3398 __ JumpIfSmi(object, &not_date_object);
3399 __ CmpObjectType(object, JS_DATE_TYPE, scratch); 3399 __ CmpObjectType(object, JS_DATE_TYPE, scratch);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
3808 __ CallStub(&stub); 3808 __ CallStub(&stub);
3809 context()->Plug(eax); 3809 context()->Plug(eax);
3810 } 3810 }
3811 3811
3812 3812
3813 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) { 3813 void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
3814 ZoneList<Expression*>* args = expr->arguments(); 3814 ZoneList<Expression*>* args = expr->arguments();
3815 ASSERT_EQ(2, args->length()); 3815 ASSERT_EQ(2, args->length());
3816 3816
3817 ASSERT_NE(NULL, args->at(0)->AsLiteral()); 3817 ASSERT_NE(NULL, args->at(0)->AsLiteral());
3818 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value(); 3818 int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
3819 3819
3820 Handle<FixedArray> jsfunction_result_caches( 3820 Handle<FixedArray> jsfunction_result_caches(
3821 isolate()->native_context()->jsfunction_result_caches()); 3821 isolate()->native_context()->jsfunction_result_caches());
3822 if (jsfunction_result_caches->length() <= cache_id) { 3822 if (jsfunction_result_caches->length() <= cache_id) {
3823 __ Abort("Attempt to use undefined cache."); 3823 __ Abort("Attempt to use undefined cache.");
3824 __ mov(eax, isolate()->factory()->undefined_value()); 3824 __ mov(eax, isolate()->factory()->undefined_value());
3825 context()->Plug(eax); 3825 context()->Plug(eax);
3826 return; 3826 return;
3827 } 3827 }
3828 3828
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
4520 } 4520 }
4521 } else { 4521 } else {
4522 // Perform the assignment as if via '='. 4522 // Perform the assignment as if via '='.
4523 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4523 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
4524 Token::ASSIGN); 4524 Token::ASSIGN);
4525 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4525 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4526 context()->Plug(eax); 4526 context()->Plug(eax);
4527 } 4527 }
4528 break; 4528 break;
4529 case NAMED_PROPERTY: { 4529 case NAMED_PROPERTY: {
4530 __ mov(ecx, prop->key()->AsLiteral()->handle()); 4530 __ mov(ecx, prop->key()->AsLiteral()->value());
4531 __ pop(edx); 4531 __ pop(edx);
4532 Handle<Code> ic = is_classic_mode() 4532 Handle<Code> ic = is_classic_mode()
4533 ? isolate()->builtins()->StoreIC_Initialize() 4533 ? isolate()->builtins()->StoreIC_Initialize()
4534 : isolate()->builtins()->StoreIC_Initialize_Strict(); 4534 : isolate()->builtins()->StoreIC_Initialize_Strict();
4535 CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId()); 4535 CallIC(ic, RelocInfo::CODE_TARGET, expr->CountStoreFeedbackId());
4536 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4536 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4537 if (expr->is_postfix()) { 4537 if (expr->is_postfix()) {
4538 if (!context()->IsEffect()) { 4538 if (!context()->IsEffect()) {
4539 context()->PlugTOS(); 4539 context()->PlugTOS();
4540 } 4540 }
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
4921 *stack_depth = 0; 4921 *stack_depth = 0;
4922 *context_length = 0; 4922 *context_length = 0;
4923 return previous_; 4923 return previous_;
4924 } 4924 }
4925 4925
4926 #undef __ 4926 #undef __
4927 4927
4928 } } // namespace v8::internal 4928 } } // namespace v8::internal
4929 4929
4930 #endif // V8_TARGET_ARCH_IA32 4930 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698