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

Side by Side Diff: src/arm/full-codegen-arm.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
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | src/arm64/full-codegen-arm64.cc » ('J')
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_ARM 7 #if V8_TARGET_ARCH_ARM
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 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 break; 2498 break;
2499 default: 2499 default:
2500 UNREACHABLE(); 2500 UNREACHABLE();
2501 } 2501 }
2502 2502
2503 __ bind(&done); 2503 __ bind(&done);
2504 context()->Plug(r0); 2504 context()->Plug(r0);
2505 } 2505 }
2506 2506
2507 2507
2508 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2509 // ctor is in r0.
2510 DCHECK(lit != NULL);
2511 __ push(r0);
2512
2513 Register scratch = r1;
2514 __ ldr(scratch,
2515 FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset));
2516 __ push(scratch);
Dmitry Lomov (no reviews) 2014/10/27 21:37:13 Add a comment about why it is ok to skip access ch
arv (Not doing code reviews) 2014/10/28 09:42:00 Done.
Dmitry Lomov (no reviews) 2014/10/28 10:34:07 Acknowledged.
2517
2518 for (int i = 0; i < lit->properties()->length(); i++) {
2519 ObjectLiteral::Property* property = lit->properties()->at(i);
2520 Literal* key = property->key()->AsLiteral();
2521 Expression* value = property->value();
2522 DCHECK(key != NULL);
2523
2524 if (property->is_static()) {
2525 __ ldr(ip, MemOperand(sp, kPointerSize)); // constructor
Dmitry Lomov (no reviews) 2014/10/27 21:37:13 Nit: use scratch register instead of 'ip' here
arv (Not doing code reviews) 2014/10/28 09:42:00 Done.
Dmitry Lomov (no reviews) 2014/10/28 10:34:08 Acknowledged.
2526 } else {
2527 __ ldr(ip, MemOperand(sp, 0)); // prototype
2528 }
2529 __ push(ip);
2530 VisitForStackValue(key);
2531
2532 switch (property->kind()) {
2533 case ObjectLiteral::Property::CONSTANT:
2534 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2535 case ObjectLiteral::Property::COMPUTED:
2536 case ObjectLiteral::Property::PROTOTYPE:
2537 VisitForStackValue(value);
2538 __ mov(r0, Operand(Smi::FromInt(NONE)));
2539 __ push(r0);
2540 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
2541 break;
2542
2543 case ObjectLiteral::Property::GETTER:
2544 VisitForStackValue(value);
2545 __ LoadRoot(r0, Heap::kNullValueRootIndex);
2546 __ push(r0);
2547 __ mov(r0, Operand(Smi::FromInt(NONE)));
2548 __ push(r0);
2549 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2550 break;
2551
2552 case ObjectLiteral::Property::SETTER:
2553 __ LoadRoot(r0, Heap::kNullValueRootIndex);
2554 __ push(r0);
2555 VisitForStackValue(value);
2556 __ mov(r0, Operand(Smi::FromInt(NONE)));
2557 __ push(r0);
2558 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2559 break;
2560
2561 default:
2562 UNREACHABLE();
2563 }
2564 }
2565
2566 // prototype
2567 __ CallRuntime(Runtime::kToFastProperties, 1);
2568
2569 // constructor
2570 __ CallRuntime(Runtime::kToFastProperties, 1);
2571
2572 context()->Plug(r0);
Dmitry Lomov (no reviews) 2014/10/27 21:37:13 The 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.
2573 }
2574
2575
2508 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2576 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2509 Token::Value op, 2577 Token::Value op,
2510 OverwriteMode mode) { 2578 OverwriteMode mode) {
2511 __ pop(r1); 2579 __ pop(r1);
2512 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); 2580 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
2513 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2581 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2514 CallIC(code, expr->BinaryOperationFeedbackId()); 2582 CallIC(code, expr->BinaryOperationFeedbackId());
2515 patch_site.EmitPatchInfo(); 2583 patch_site.EmitPatchInfo();
2516 context()->Plug(r0); 2584 context()->Plug(r0);
2517 } 2585 }
(...skipping 2760 matching lines...) Expand 10 before | Expand all | Expand 10 after
5278 5346
5279 DCHECK(interrupt_address == 5347 DCHECK(interrupt_address ==
5280 isolate->builtins()->OsrAfterStackCheck()->entry()); 5348 isolate->builtins()->OsrAfterStackCheck()->entry());
5281 return OSR_AFTER_STACK_CHECK; 5349 return OSR_AFTER_STACK_CHECK;
5282 } 5350 }
5283 5351
5284 5352
5285 } } // namespace v8::internal 5353 } } // namespace v8::internal
5286 5354
5287 #endif // V8_TARGET_ARCH_ARM 5355 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | src/arm64/full-codegen-arm64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698