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

Side by Side Diff: src/stub-cache.cc

Issue 19485008: Replace CONSTANT_FUNCTION by CONSTANT (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/lithium-codegen-x64.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 // 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 Handle<Code> handler = 328 Handle<Code> handler =
329 compiler.CompileLoadViaGetter(receiver, holder, name, getter); 329 compiler.CompileLoadViaGetter(receiver, holder, name, getter);
330 JSObject::UpdateMapCodeCache(stub_holder, name, handler); 330 JSObject::UpdateMapCodeCache(stub_holder, name, handler);
331 return handler; 331 return handler;
332 } 332 }
333 333
334 334
335 Handle<Code> StubCache::ComputeLoadConstant(Handle<Name> name, 335 Handle<Code> StubCache::ComputeLoadConstant(Handle<Name> name,
336 Handle<JSObject> receiver, 336 Handle<JSObject> receiver,
337 Handle<JSObject> holder, 337 Handle<JSObject> holder,
338 Handle<JSFunction> value) { 338 Handle<Object> value) {
339 Handle<JSObject> stub_holder = StubHolder(receiver, holder); 339 Handle<JSObject> stub_holder = StubHolder(receiver, holder);
340 Handle<Code> handler = FindLoadHandler( 340 Handle<Code> handler = FindLoadHandler(
341 name, receiver, stub_holder, Code::LOAD_IC, Code::CONSTANT_FUNCTION); 341 name, receiver, stub_holder, Code::LOAD_IC, Code::CONSTANT);
342 if (!handler.is_null()) return handler; 342 if (!handler.is_null()) return handler;
343 343
344 LoadStubCompiler compiler(isolate_); 344 LoadStubCompiler compiler(isolate_);
345 handler = compiler.CompileLoadConstant(receiver, holder, name, value); 345 handler = compiler.CompileLoadConstant(receiver, holder, name, value);
346 JSObject::UpdateMapCodeCache(stub_holder, name, handler); 346 JSObject::UpdateMapCodeCache(stub_holder, name, handler);
347 347
348 return handler; 348 return handler;
349 } 349 }
350 350
351 351
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 Handle<Code> handler = 410 Handle<Code> handler =
411 compiler.CompileLoadField(receiver, holder, name, field, representation); 411 compiler.CompileLoadField(receiver, holder, name, field, representation);
412 JSObject::UpdateMapCodeCache(stub_holder, name, handler); 412 JSObject::UpdateMapCodeCache(stub_holder, name, handler);
413 return handler; 413 return handler;
414 } 414 }
415 415
416 416
417 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<Name> name, 417 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<Name> name,
418 Handle<JSObject> receiver, 418 Handle<JSObject> receiver,
419 Handle<JSObject> holder, 419 Handle<JSObject> holder,
420 Handle<JSFunction> value) { 420 Handle<Object> value) {
421 Handle<JSObject> stub_holder = StubHolder(receiver, holder); 421 Handle<JSObject> stub_holder = StubHolder(receiver, holder);
422 Handle<Code> handler = FindLoadHandler( 422 Handle<Code> handler = FindLoadHandler(
423 name, receiver, stub_holder, Code::KEYED_LOAD_IC, 423 name, receiver, stub_holder, Code::KEYED_LOAD_IC,
424 Code::CONSTANT_FUNCTION); 424 Code::CONSTANT);
425 if (!handler.is_null()) return handler; 425 if (!handler.is_null()) return handler;
426 426
427 KeyedLoadStubCompiler compiler(isolate_); 427 KeyedLoadStubCompiler compiler(isolate_);
428 handler = compiler.CompileLoadConstant(receiver, holder, name, value); 428 handler = compiler.CompileLoadConstant(receiver, holder, name, value);
429 JSObject::UpdateMapCodeCache(stub_holder, name, handler); 429 JSObject::UpdateMapCodeCache(stub_holder, name, handler);
430 return handler; 430 return handler;
431 } 431 }
432 432
433 433
434 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<Name> name, 434 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<Name> name,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 691
692 if (check != RECEIVER_MAP_CHECK && 692 if (check != RECEIVER_MAP_CHECK &&
693 !function->IsBuiltin() && 693 !function->IsBuiltin() &&
694 function->shared()->is_classic_mode()) { 694 function->shared()->is_classic_mode()) {
695 // Calling non-strict non-builtins with a value as the receiver 695 // Calling non-strict non-builtins with a value as the receiver
696 // requires boxing. 696 // requires boxing.
697 return Handle<Code>::null(); 697 return Handle<Code>::null();
698 } 698 }
699 699
700 Code::Flags flags = Code::ComputeMonomorphicFlags( 700 Code::Flags flags = Code::ComputeMonomorphicFlags(
701 kind, extra_state, Code::CONSTANT_FUNCTION, argc, cache_holder); 701 kind, extra_state, Code::CONSTANT, argc, cache_holder);
702 Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags), 702 Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags),
703 isolate_); 703 isolate_);
704 if (probe->IsCode()) return Handle<Code>::cast(probe); 704 if (probe->IsCode()) return Handle<Code>::cast(probe);
705 705
706 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); 706 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder);
707 Handle<Code> code = 707 Handle<Code> code =
708 compiler.CompileCallConstant(object, holder, name, check, function); 708 compiler.CompileCallConstant(object, holder, name, check, function);
709 code->set_check_type(check); 709 code->set_check_type(check);
710 ASSERT(flags == code->flags()); 710 ASSERT(flags == code->flags());
711 PROFILE(isolate_, 711 PROFILE(isolate_,
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 1612
1613 // Return the generated code. 1613 // Return the generated code.
1614 return GetCode(kind(), Code::FIELD, name); 1614 return GetCode(kind(), Code::FIELD, name);
1615 } 1615 }
1616 1616
1617 1617
1618 Handle<Code> BaseLoadStubCompiler::CompileLoadConstant( 1618 Handle<Code> BaseLoadStubCompiler::CompileLoadConstant(
1619 Handle<JSObject> object, 1619 Handle<JSObject> object,
1620 Handle<JSObject> holder, 1620 Handle<JSObject> holder,
1621 Handle<Name> name, 1621 Handle<Name> name,
1622 Handle<JSFunction> value) { 1622 Handle<Object> value) {
1623 Label success; 1623 Label success;
1624 HandlerFrontend(object, receiver(), holder, name, &success); 1624 HandlerFrontend(object, receiver(), holder, name, &success);
1625 __ bind(&success); 1625 __ bind(&success);
1626 GenerateLoadConstant(value); 1626 GenerateLoadConstant(value);
1627 1627
1628 // Return the generated code. 1628 // Return the generated code.
1629 return GetCode(kind(), Code::CONSTANT_FUNCTION, name); 1629 return GetCode(kind(), Code::CONSTANT, name);
1630 } 1630 }
1631 1631
1632 1632
1633 Handle<Code> BaseLoadStubCompiler::CompileLoadCallback( 1633 Handle<Code> BaseLoadStubCompiler::CompileLoadCallback(
1634 Handle<JSObject> object, 1634 Handle<JSObject> object,
1635 Handle<JSObject> holder, 1635 Handle<JSObject> holder,
1636 Handle<Name> name, 1636 Handle<Name> name,
1637 Handle<ExecutableAccessorInfo> callback) { 1637 Handle<ExecutableAccessorInfo> callback) {
1638 Label success; 1638 Label success;
1639 1639
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 cache_holder_); 2123 cache_holder_);
2124 return GetCodeWithFlags(flags, name); 2124 return GetCodeWithFlags(flags, name);
2125 } 2125 }
2126 2126
2127 2127
2128 Handle<Code> CallStubCompiler::GetCode(Handle<JSFunction> function) { 2128 Handle<Code> CallStubCompiler::GetCode(Handle<JSFunction> function) {
2129 Handle<String> function_name; 2129 Handle<String> function_name;
2130 if (function->shared()->name()->IsString()) { 2130 if (function->shared()->name()->IsString()) {
2131 function_name = Handle<String>(String::cast(function->shared()->name())); 2131 function_name = Handle<String>(String::cast(function->shared()->name()));
2132 } 2132 }
2133 return GetCode(Code::CONSTANT_FUNCTION, function_name); 2133 return GetCode(Code::CONSTANT, function_name);
2134 } 2134 }
2135 2135
2136 2136
2137 CallOptimization::CallOptimization(LookupResult* lookup) { 2137 CallOptimization::CallOptimization(LookupResult* lookup) {
2138 if (lookup->IsFound() && 2138 if (lookup->IsFound() &&
2139 lookup->IsCacheable() && 2139 lookup->IsCacheable() &&
2140 lookup->type() == CONSTANT_FUNCTION) { 2140 lookup->IsConstantFunction()) {
2141 // We only optimize constant function calls. 2141 // We only optimize constant function calls.
2142 Initialize(Handle<JSFunction>(lookup->GetConstantFunction())); 2142 Initialize(Handle<JSFunction>(lookup->GetConstantFunction()));
2143 } else { 2143 } else {
2144 Initialize(Handle<JSFunction>::null()); 2144 Initialize(Handle<JSFunction>::null());
2145 } 2145 }
2146 } 2146 }
2147 2147
2148 2148
2149 CallOptimization::CallOptimization(Handle<JSFunction> function) { 2149 CallOptimization::CallOptimization(Handle<JSFunction> function) {
2150 Initialize(function); 2150 Initialize(function);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 Handle<FunctionTemplateInfo>( 2201 Handle<FunctionTemplateInfo>(
2202 FunctionTemplateInfo::cast(signature->receiver())); 2202 FunctionTemplateInfo::cast(signature->receiver()));
2203 } 2203 }
2204 } 2204 }
2205 2205
2206 is_simple_api_call_ = true; 2206 is_simple_api_call_ = true;
2207 } 2207 }
2208 2208
2209 2209
2210 } } // namespace v8::internal 2210 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698