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

Side by Side Diff: src/x64/full-codegen-x64.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_X64 7 #if V8_TARGET_ARCH_X64
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 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 default: 2413 default:
2414 UNREACHABLE(); 2414 UNREACHABLE();
2415 break; 2415 break;
2416 } 2416 }
2417 2417
2418 __ bind(&done); 2418 __ bind(&done);
2419 context()->Plug(rax); 2419 context()->Plug(rax);
2420 } 2420 }
2421 2421
2422 2422
2423 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2424 // ctor is in rax.
2425 DCHECK(lit != NULL);
2426 __ Push(rax);
2427
2428 Register scratch = rcx;
Dmitry Lomov (no reviews) 2014/10/27 21:37:14 Nit: Why rcx here, but ebx in ia32?
arv (Not doing code reviews) 2014/10/27 22:20:53 Because I don't know enough about the different re
arv (Not doing code reviews) 2014/10/28 09:42:00 Done.
Dmitry Lomov (no reviews) 2014/10/28 10:34:08 Acknowledged.
2429 __ movp(scratch, FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset));
Dmitry Lomov (no reviews) 2014/10/27 21:37:14 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.
2430 __ Push(scratch);
2431
2432 for (int i = 0; i < lit->properties()->length(); i++) {
2433 ObjectLiteral::Property* property = lit->properties()->at(i);
2434 Literal* key = property->key()->AsLiteral();
2435 Expression* value = property->value();
2436 DCHECK(key != NULL);
2437
2438 if (property->is_static()) {
2439 __ Push(Operand(rsp, kPointerSize)); // constructor
2440 } else {
2441 __ Push(Operand(rsp, 0)); // prototype
2442 }
2443 VisitForStackValue(key);
2444
2445 switch (property->kind()) {
2446 case ObjectLiteral::Property::CONSTANT:
2447 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2448 case ObjectLiteral::Property::COMPUTED:
2449 case ObjectLiteral::Property::PROTOTYPE:
2450 VisitForStackValue(value);
2451 __ Push(Smi::FromInt(NONE));
2452 __ CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4);
2453 break;
2454
2455 case ObjectLiteral::Property::GETTER:
2456 VisitForStackValue(value);
2457 __ Push(isolate()->factory()->null_value());
2458 __ Push(Smi::FromInt(NONE));
2459 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2460 break;
2461
2462 case ObjectLiteral::Property::SETTER:
2463 __ Push(isolate()->factory()->null_value());
2464 VisitForStackValue(value);
2465 __ Push(Smi::FromInt(NONE));
2466 __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5);
2467 break;
2468
2469 default:
2470 UNREACHABLE();
2471 }
2472 }
2473
2474 // prototype
2475 __ CallRuntime(Runtime::kToFastProperties, 1);
2476
2477 // constructor
2478 __ CallRuntime(Runtime::kToFastProperties, 1);
2479
2480 context()->Plug(rax);
Dmitry Lomov (no reviews) 2014/10/27 21:37:14 Caller plugs context
arv (Not doing code reviews) 2014/10/28 09:42:00 Done.
Dmitry Lomov (no reviews) 2014/10/28 10:34:08 Acknowledged.
2481 }
2482
2483
2423 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 2484 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
2424 Token::Value op, 2485 Token::Value op,
2425 OverwriteMode mode) { 2486 OverwriteMode mode) {
2426 __ Pop(rdx); 2487 __ Pop(rdx);
2427 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); 2488 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code();
2428 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2489 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2429 CallIC(code, expr->BinaryOperationFeedbackId()); 2490 CallIC(code, expr->BinaryOperationFeedbackId());
2430 patch_site.EmitPatchInfo(); 2491 patch_site.EmitPatchInfo();
2431 context()->Plug(rax); 2492 context()->Plug(rax);
2432 } 2493 }
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
5174 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5235 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5175 Assembler::target_address_at(call_target_address, 5236 Assembler::target_address_at(call_target_address,
5176 unoptimized_code)); 5237 unoptimized_code));
5177 return OSR_AFTER_STACK_CHECK; 5238 return OSR_AFTER_STACK_CHECK;
5178 } 5239 }
5179 5240
5180 5241
5181 } } // namespace v8::internal 5242 } } // namespace v8::internal
5182 5243
5183 #endif // V8_TARGET_ARCH_X64 5244 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698