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/parser.cc

Issue 1143813002: Reland "[strong] Object literals create strong objects" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix handlification bug Created 5 years, 7 months 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
« no previous file with comments | « src/objects.cc ('k') | src/preparser.h » ('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 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 5603 matching lines...) Expand 10 before | Expand all | Expand 10 after
5614 } else { 5614 } else {
5615 uint32_t hash = ComputeTemplateLiteralHash(lit); 5615 uint32_t hash = ComputeTemplateLiteralHash(lit);
5616 5616
5617 int cooked_idx = function_state_->NextMaterializedLiteralIndex(); 5617 int cooked_idx = function_state_->NextMaterializedLiteralIndex();
5618 int raw_idx = function_state_->NextMaterializedLiteralIndex(); 5618 int raw_idx = function_state_->NextMaterializedLiteralIndex();
5619 5619
5620 // $getTemplateCallSite 5620 // $getTemplateCallSite
5621 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(4, zone()); 5621 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(4, zone());
5622 args->Add(factory()->NewArrayLiteral( 5622 args->Add(factory()->NewArrayLiteral(
5623 const_cast<ZoneList<Expression*>*>(cooked_strings), 5623 const_cast<ZoneList<Expression*>*>(cooked_strings),
5624 cooked_idx, pos), 5624 cooked_idx, is_strong(language_mode()), pos),
5625 zone()); 5625 zone());
5626 args->Add( 5626 args->Add(
5627 factory()->NewArrayLiteral( 5627 factory()->NewArrayLiteral(
5628 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, pos), 5628 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx,
5629 is_strong(language_mode()), pos),
5629 zone()); 5630 zone());
5630 5631
5631 // Ensure hash is suitable as a Smi value 5632 // Ensure hash is suitable as a Smi value
5632 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); 5633 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash)));
5633 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone()); 5634 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone());
5634 5635
5635 this->CheckPossibleEvalCall(tag, scope_); 5636 this->CheckPossibleEvalCall(tag, scope_);
5636 Expression* call_site = factory()->NewCallRuntime( 5637 Expression* call_site = factory()->NewCallRuntime(
5637 ast_value_factory()->get_template_callsite_string(), NULL, args, start); 5638 ast_value_factory()->get_template_callsite_string(), NULL, args, start);
5638 5639
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
5709 if (!list->at(i)->IsSpread()) { 5710 if (!list->at(i)->IsSpread()) {
5710 ZoneList<v8::internal::Expression*>* unspread = 5711 ZoneList<v8::internal::Expression*>* unspread =
5711 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); 5712 new (zone()) ZoneList<v8::internal::Expression*>(1, zone());
5712 5713
5713 // Push array of unspread parameters 5714 // Push array of unspread parameters
5714 while (i < n && !list->at(i)->IsSpread()) { 5715 while (i < n && !list->at(i)->IsSpread()) {
5715 unspread->Add(list->at(i++), zone()); 5716 unspread->Add(list->at(i++), zone());
5716 } 5717 }
5717 int literal_index = function_state_->NextMaterializedLiteralIndex(); 5718 int literal_index = function_state_->NextMaterializedLiteralIndex();
5718 args->Add(factory()->NewArrayLiteral(unspread, literal_index, 5719 args->Add(factory()->NewArrayLiteral(unspread, literal_index,
5720 is_strong(language_mode()),
5719 RelocInfo::kNoPosition), 5721 RelocInfo::kNoPosition),
5720 zone()); 5722 zone());
5721 5723
5722 if (i == n) break; 5724 if (i == n) break;
5723 } 5725 }
5724 5726
5725 // Push eagerly spread argument 5727 // Push eagerly spread argument
5726 ZoneList<v8::internal::Expression*>* spread_list = 5728 ZoneList<v8::internal::Expression*>* spread_list =
5727 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); 5729 new (zone()) ZoneList<v8::internal::Expression*>(1, zone());
5728 spread_list->Add(list->at(i++)->AsSpread()->expression(), zone()); 5730 spread_list->Add(list->at(i++)->AsSpread()->expression(), zone());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5792 5794
5793 Expression* Parser::SpreadCallNew(Expression* function, 5795 Expression* Parser::SpreadCallNew(Expression* function,
5794 ZoneList<v8::internal::Expression*>* args, 5796 ZoneList<v8::internal::Expression*>* args,
5795 int pos) { 5797 int pos) {
5796 args->InsertAt(0, function, zone()); 5798 args->InsertAt(0, function, zone());
5797 5799
5798 return factory()->NewCallRuntime( 5800 return factory()->NewCallRuntime(
5799 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5801 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5800 } 5802 }
5801 } } // namespace v8::internal 5803 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698