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

Unified Diff: src/runtime/runtime-literals.cc

Issue 2632503003: [runtime] Allocate space for computed property names (Closed)
Patch Set: Fix some variable names. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« src/parsing/parser-base.h ('K') | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-literals.cc
diff --git a/src/runtime/runtime-literals.cc b/src/runtime/runtime-literals.cc
index 45b83293b6334d48ee6f7a4292f062aab46889bc..fb99ddee21cb267365e9d424ae06740140f0c02d 100644
--- a/src/runtime/runtime-literals.cc
+++ b/src/runtime/runtime-literals.cc
@@ -15,12 +15,11 @@ namespace v8 {
namespace internal {
static Handle<Map> ComputeObjectLiteralMap(
- Handle<Context> context, Handle<FixedArray> constant_properties,
+ Handle<Context> context, Handle<ConstantProperties> constant_properties,
bool* is_result_from_cache) {
- int properties_length = constant_properties->length();
- int number_of_properties = properties_length / 2;
+ int number_of_properties = constant_properties->number_of_properties();
- for (int p = 0; p != properties_length; p += 2) {
+ for (int p = 0; p != constant_properties->length(); p += 2) {
Object* key = constant_properties->get(p);
uint32_t element_index = 0;
if (key->ToArrayIndex(&element_index)) {
@@ -35,11 +34,12 @@ static Handle<Map> ComputeObjectLiteralMap(
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
Isolate* isolate, Handle<LiteralsArray> literals,
- Handle<FixedArray> constant_properties);
+ Handle<ConstantProperties> constant_properties);
MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
Isolate* isolate, Handle<LiteralsArray> literals,
- Handle<FixedArray> constant_properties, bool should_have_fast_elements) {
+ Handle<ConstantProperties> constant_properties,
+ bool should_have_fast_elements) {
Handle<Context> context = isolate->native_context();
// In case we have function literals, we want the object to be in
@@ -76,7 +76,8 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
if (value->IsFixedArray()) {
// The value contains the constant_properties of a
// simple object or array literal.
- Handle<FixedArray> array = Handle<FixedArray>::cast(value);
+ Handle<ConstantProperties> array =
+ Handle<ConstantProperties>::cast(value);
ASSIGN_RETURN_ON_EXCEPTION(
isolate, value, CreateLiteralBoilerplate(isolate, literals, array),
Object);
@@ -164,8 +165,8 @@ static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
if (fixed_array_values->get(i)->IsFixedArray()) {
// The value contains the constant_properties of a
// simple object or array literal.
- Handle<FixedArray> fa(
- FixedArray::cast(fixed_array_values->get(i)));
+ Handle<ConstantProperties> fa(
+ ConstantProperties::cast(fixed_array_values->get(i)));
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
@@ -184,15 +185,17 @@ static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
Isolate* isolate, Handle<LiteralsArray> literals,
- Handle<FixedArray> array) {
+ Handle<ConstantProperties> array) {
Handle<HeapObject> elements = CompileTimeValue::GetElements(array);
switch (CompileTimeValue::GetLiteralType(array)) {
case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS: {
- Handle<FixedArray> props = Handle<FixedArray>::cast(elements);
+ Handle<ConstantProperties> props =
+ Handle<ConstantProperties>::cast(elements);
return CreateObjectLiteralBoilerplate(isolate, literals, props, true);
}
case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS: {
- Handle<FixedArray> props = Handle<FixedArray>::cast(elements);
+ Handle<ConstantProperties> props =
+ Handle<ConstantProperties>::cast(elements);
return CreateObjectLiteralBoilerplate(isolate, literals, props, false);
}
case CompileTimeValue::ARRAY_LITERAL: {
@@ -231,7 +234,7 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, closure, 0);
CONVERT_SMI_ARG_CHECKED(literals_index, 1);
- CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
+ CONVERT_ARG_HANDLE_CHECKED(ConstantProperties, constant_properties, 2);
CONVERT_SMI_ARG_CHECKED(flags, 3);
Handle<LiteralsArray> literals(closure->literals(), isolate);
bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0;
« src/parsing/parser-base.h ('K') | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698