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

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: 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 | « no previous file | src/arm64/full-codegen-arm64.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_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 // Constructor is in r0.
2510 DCHECK(lit != NULL);
2511 __ push(r0);
2512
2513 // No access check is needed here since the constructor is created by the
2514 // class literal.
2515 Register scratch = r1;
2516 __ ldr(scratch,
2517 FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset));
2518 __ push(scratch);
2519
2520 for (int i = 0; i < lit->properties()->length(); i++) {
2521 ObjectLiteral::Property* property = lit->properties()->at(i);
2522 Literal* key = property->key()->AsLiteral();
2523 Expression* value = property->value();
2524 DCHECK(key != NULL);
2525
2526 if (property->is_static()) {
2527 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor
2528 } else {
2529 __ ldr(scratch, MemOperand(sp, 0)); // prototype
2530 }
2531 __ push(scratch);
2532 VisitForStackValue(key);
2533
2534 switch (property->kind()) {
2535 case ObjectLiteral::Property::CONSTANT:
2536 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2537 case ObjectLiteral::Property::COMPUTED:
2538 case ObjectLiteral::Property::PROTOTYPE:
2539 VisitForStackValue(value);
2540 __ mov(scratch, Operand(Smi::FromInt(NONE)));
2541 __ push(scratch);
2542 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
2543 break;
2544
2545 case ObjectLiteral::Property::GETTER:
2546 VisitForStackValue(value);
2547 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2548 __ push(scratch);
2549 __ mov(scratch, Operand(Smi::FromInt(NONE)));
2550 __ push(scratch);
2551 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2552 break;
2553
2554 case ObjectLiteral::Property::SETTER:
2555 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
2556 __ push(scratch);
2557 VisitForStackValue(value);
2558 __ mov(scratch, Operand(Smi::FromInt(NONE)));
2559 __ push(scratch);
2560 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2561 break;
2562
2563 default:
2564 UNREACHABLE();
2565 }
2566 }
2567
2568 // prototype
2569 __ CallRuntime(Runtime::kToFastProperties, 1);
2570
2571 // constructor
2572 __ CallRuntime(Runtime::kToFastProperties, 1);
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 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after
5282 5350
5283 DCHECK(interrupt_address == 5351 DCHECK(interrupt_address ==
5284 isolate->builtins()->OsrAfterStackCheck()->entry()); 5352 isolate->builtins()->OsrAfterStackCheck()->entry());
5285 return OSR_AFTER_STACK_CHECK; 5353 return OSR_AFTER_STACK_CHECK;
5286 } 5354 }
5287 5355
5288 5356
5289 } } // namespace v8::internal 5357 } } // namespace v8::internal
5290 5358
5291 #endif // V8_TARGET_ARCH_ARM 5359 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698