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

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

Issue 680993003: Classes: Add basic support for properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: git rebase Created 6 years, 1 month 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/full-codegen.cc ('k') | src/x64/full-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 // 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 break; 2414 break;
2415 default: 2415 default:
2416 UNREACHABLE(); 2416 UNREACHABLE();
2417 } 2417 }
2418 2418
2419 __ bind(&done); 2419 __ bind(&done);
2420 context()->Plug(eax); 2420 context()->Plug(eax);
2421 } 2421 }
2422 2422
2423 2423
2424 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2425 // Constructor is in eax.
2426 DCHECK(lit != NULL);
2427 __ push(eax);
2428
2429 // No access check is needed here since the constructor is created by the
2430 // class literal.
2431 Register scratch = ebx;
2432 __ mov(scratch, FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset));
2433 __ Push(scratch);
2434
2435 for (int i = 0; i < lit->properties()->length(); i++) {
2436 ObjectLiteral::Property* property = lit->properties()->at(i);
2437 Literal* key = property->key()->AsLiteral();
2438 Expression* value = property->value();
2439 DCHECK(key != NULL);
2440
2441 if (property->is_static()) {
2442 __ push(Operand(esp, kPointerSize)); // constructor
2443 } else {
2444 __ push(Operand(esp, 0)); // prototype
2445 }
2446 VisitForStackValue(key);
2447
2448 switch (property->kind()) {
2449 case ObjectLiteral::Property::CONSTANT:
2450 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2451 case ObjectLiteral::Property::COMPUTED:
2452 case ObjectLiteral::Property::PROTOTYPE:
2453 VisitForStackValue(value);
2454 __ push(Immediate(Smi::FromInt(NONE)));
2455 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
2456 break;
2457
2458 case ObjectLiteral::Property::GETTER:
2459 VisitForStackValue(value);
2460 __ push(Immediate(isolate()->factory()->null_value()));
2461 __ push(Immediate(Smi::FromInt(NONE)));
2462 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2463 break;
2464
2465 case ObjectLiteral::Property::SETTER:
2466 __ push(Immediate(isolate()->factory()->null_value()));
2467 VisitForStackValue(value);
2468 __ push(Immediate(Smi::FromInt(NONE)));
2469 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2470 break;
2471
2472 default:
2473 UNREACHABLE();
2474 }
2475 }
2476
2477 // prototype
2478 __ CallRuntime(Runtime::kToFastProperties, 1);
2479
2480 // constructor
2481 __ CallRuntime(Runtime::kToFastProperties, 1);
2482 }
2483
2484
2424 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2485 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2425 Token::Value op, 2486 Token::Value op,
2426 OverwriteMode mode) { 2487 OverwriteMode mode) {
2427 __ pop(edx); 2488 __ pop(edx);
2428 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); 2489 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
2429 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2490 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2430 CallIC(code, expr->BinaryOperationFeedbackId()); 2491 CallIC(code, expr->BinaryOperationFeedbackId());
2431 patch_site.EmitPatchInfo(); 2492 patch_site.EmitPatchInfo();
2432 context()->Plug(eax); 2493 context()->Plug(eax);
2433 } 2494 }
(...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after
5161 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5222 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5162 Assembler::target_address_at(call_target_address, 5223 Assembler::target_address_at(call_target_address,
5163 unoptimized_code)); 5224 unoptimized_code));
5164 return OSR_AFTER_STACK_CHECK; 5225 return OSR_AFTER_STACK_CHECK;
5165 } 5226 }
5166 5227
5167 5228
5168 } } // namespace v8::internal 5229 } } // namespace v8::internal
5169 5230
5170 #endif // V8_TARGET_ARCH_IA32 5231 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698