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

Side by Side Diff: src/hydrogen.cc

Issue 23537067: Add support for keyed-call on arrays of fast elements (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM port and clean up frameless SP-relative argument fetching Created 7 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 | « src/hydrogen.h ('k') | src/hydrogen-instructions.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 HValue* constructor_function) : 2371 HValue* constructor_function) :
2372 builder_(builder), 2372 builder_(builder),
2373 kind_(kind), 2373 kind_(kind),
2374 mode_(DONT_TRACK_ALLOCATION_SITE), 2374 mode_(DONT_TRACK_ALLOCATION_SITE),
2375 allocation_site_payload_(NULL), 2375 allocation_site_payload_(NULL),
2376 constructor_function_(constructor_function) { 2376 constructor_function_(constructor_function) {
2377 } 2377 }
2378 2378
2379 2379
2380 HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() { 2380 HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() {
2381 if (kind_ == GetInitialFastElementsKind()) { 2381 if (constructor_function_ != NULL && kind_ == GetInitialFastElementsKind()) {
2382 // No need for a context lookup if the kind_ matches the initial 2382 // No need for a context lookup if the kind_ matches the initial
2383 // map, because we can just load the map in that case. 2383 // map, because we can just load the map in that case.
2384 HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap(); 2384 HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap();
2385 return builder()->AddLoadNamedField(constructor_function_, access); 2385 return builder()->AddLoadNamedField(constructor_function_, access);
2386 } 2386 }
2387 2387
2388 HInstruction* native_context = builder()->BuildGetNativeContext(); 2388 HInstruction* native_context = builder()->BuildGetNativeContext();
2389 HInstruction* index = builder()->Add<HConstant>( 2389 HInstruction* index = builder()->Add<HConstant>(
2390 static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX)); 2390 static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX));
2391 2391
(...skipping 4956 matching lines...) Expand 10 before | Expand all | Expand 10 after
7348 ASSERT(current_block() != NULL); 7348 ASSERT(current_block() != NULL);
7349 ASSERT(current_block()->HasPredecessor()); 7349 ASSERT(current_block()->HasPredecessor());
7350 Expression* callee = expr->expression(); 7350 Expression* callee = expr->expression();
7351 int argument_count = expr->arguments()->length() + 1; // Plus receiver. 7351 int argument_count = expr->arguments()->length() + 1; // Plus receiver.
7352 HInstruction* call = NULL; 7352 HInstruction* call = NULL;
7353 7353
7354 Property* prop = callee->AsProperty(); 7354 Property* prop = callee->AsProperty();
7355 if (prop != NULL) { 7355 if (prop != NULL) {
7356 if (!prop->key()->IsPropertyName()) { 7356 if (!prop->key()->IsPropertyName()) {
7357 // Keyed function call. 7357 // Keyed function call.
7358 CHECK_ALIVE(VisitArgument(prop->obj())); 7358 CHECK_ALIVE(VisitForValue(prop->obj()));
7359 CHECK_ALIVE(VisitForValue(prop->key()));
7359 7360
7360 CHECK_ALIVE(VisitForValue(prop->key()));
7361 // Push receiver and key like the non-optimized code generator expects it. 7361 // Push receiver and key like the non-optimized code generator expects it.
7362 HValue* key = Pop(); 7362 HValue* key = Pop();
7363 HValue* receiver = Pop(); 7363 HValue* receiver = Pop();
7364 Push(key); 7364 Push(key);
7365 Push(receiver); 7365 Push(Add<HPushArgument>(receiver));
7366
7367 CHECK_ALIVE(VisitArgumentList(expr->arguments())); 7366 CHECK_ALIVE(VisitArgumentList(expr->arguments()));
7368 7367
7369 call = New<HCallKeyed>(key, argument_count); 7368 if (expr->IsMonomorphic()) {
7369 BuildCheckHeapObject(receiver);
7370 ElementsKind kind = expr->KeyedArrayCallIsHoley()
7371 ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS;
7372
7373 Handle<Map> map(isolate()->get_initial_js_array_map(kind));
7374
7375 HValue* function = BuildMonomorphicElementAccess(
7376 receiver, key, NULL, NULL, map, false, STANDARD_STORE);
7377
7378 call = New<HCallFunction>(function, argument_count);
7379 } else {
7380 call = New<HCallKeyed>(key, argument_count);
7381 }
7370 Drop(argument_count + 1); // 1 is the key. 7382 Drop(argument_count + 1); // 1 is the key.
7371 return ast_context()->ReturnInstruction(call, expr->id()); 7383 return ast_context()->ReturnInstruction(call, expr->id());
7372 } 7384 }
7373 7385
7374 // Named function call. 7386 // Named function call.
7375 if (TryCallApply(expr)) return; 7387 if (TryCallApply(expr)) return;
7376 7388
7377 CHECK_ALIVE(VisitForValue(prop->obj())); 7389 CHECK_ALIVE(VisitForValue(prop->obj()));
7378 CHECK_ALIVE(VisitExpressions(expr->arguments())); 7390 CHECK_ALIVE(VisitExpressions(expr->arguments()));
7379 7391
(...skipping 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after
10168 if (ShouldProduceTraceOutput()) { 10180 if (ShouldProduceTraceOutput()) {
10169 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10181 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10170 } 10182 }
10171 10183
10172 #ifdef DEBUG 10184 #ifdef DEBUG
10173 graph_->Verify(false); // No full verify. 10185 graph_->Verify(false); // No full verify.
10174 #endif 10186 #endif
10175 } 10187 }
10176 10188
10177 } } // namespace v8::internal 10189 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698