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

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: 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
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 // ctor is in eax.
2426 DCHECK(lit != NULL);
2427 __ push(eax);
2428
2429 Register scratch = ebx;
2430 __ mov(scratch, FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset));
Dmitry Lomov (no reviews) 2014/10/27 21:37:13 Access check comment.
arv (Not doing code reviews) 2014/10/28 09:42:00 Done.
Dmitry Lomov (no reviews) 2014/10/28 10:34:08 Acknowledged.
2431 __ Push(scratch);
2432
2433 for (int i = 0; i < lit->properties()->length(); i++) {
2434 ObjectLiteral::Property* property = lit->properties()->at(i);
2435 Literal* key = property->key()->AsLiteral();
2436 Expression* value = property->value();
2437 DCHECK(key != NULL);
2438
2439 if (property->is_static()) {
2440 __ push(Operand(esp, kPointerSize)); // constructor
2441 } else {
2442 __ push(Operand(esp, 0)); // prototype
2443 }
2444 VisitForStackValue(key);
2445
2446 switch (property->kind()) {
2447 case ObjectLiteral::Property::CONSTANT:
2448 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2449 case ObjectLiteral::Property::COMPUTED:
2450 case ObjectLiteral::Property::PROTOTYPE:
2451 VisitForStackValue(value);
2452 __ push(Immediate(Smi::FromInt(NONE)));
2453 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
2454 break;
2455
2456 case ObjectLiteral::Property::GETTER:
2457 VisitForStackValue(value);
2458 __ push(Immediate(isolate()->factory()->null_value()));
2459 __ push(Immediate(Smi::FromInt(NONE)));
2460 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2461 break;
2462
2463 case ObjectLiteral::Property::SETTER:
2464 __ push(Immediate(isolate()->factory()->null_value()));
2465 VisitForStackValue(value);
2466 __ push(Immediate(Smi::FromInt(NONE)));
2467 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2468 break;
2469
2470 default:
2471 UNREACHABLE();
2472 }
2473 }
2474
2475 // prototype
2476 __ CallRuntime(Runtime::kToFastProperties, 1);
2477
2478 // constructor
2479 __ CallRuntime(Runtime::kToFastProperties, 1);
2480
2481 context()->Plug(eax);
Dmitry Lomov (no reviews) 2014/10/27 21:37:14 Caller plugs context; no need to do it here
arv (Not doing code reviews) 2014/10/28 09:42:00 Done.
Dmitry Lomov (no reviews) 2014/10/28 10:34:08 Acknowledged.
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 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after
5159 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5220 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5160 Assembler::target_address_at(call_target_address, 5221 Assembler::target_address_at(call_target_address,
5161 unoptimized_code)); 5222 unoptimized_code));
5162 return OSR_AFTER_STACK_CHECK; 5223 return OSR_AFTER_STACK_CHECK;
5163 } 5224 }
5164 5225
5165 5226
5166 } } // namespace v8::internal 5227 } } // namespace v8::internal
5167 5228
5168 #endif // V8_TARGET_ARCH_IA32 5229 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698