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

Side by Side Diff: src/ic.h

Issue 279423005: Customized support for feedback on calls to Array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase and comments. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ic.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 // 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 #ifndef V8_IC_H_ 5 #ifndef V8_IC_H_
6 #define V8_IC_H_ 6 #define V8_IC_H_
7 7
8 #include "macro-assembler.h" 8 #include "macro-assembler.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 IC::UtilityId id() const { return id_; } 326 IC::UtilityId id() const { return id_; }
327 private: 327 private:
328 Address address_; 328 Address address_;
329 IC::UtilityId id_; 329 IC::UtilityId id_;
330 }; 330 };
331 331
332 332
333 class CallIC: public IC { 333 class CallIC: public IC {
334 public: 334 public:
335 enum CallType { METHOD, FUNCTION }; 335 enum CallType { METHOD, FUNCTION };
336 enum StubType { DEFAULT, MONOMORPHIC_ARRAY };
336 337
337 class State V8_FINAL BASE_EMBEDDED { 338 class State V8_FINAL BASE_EMBEDDED {
338 public: 339 public:
339 explicit State(ExtraICState extra_ic_state); 340 explicit State(ExtraICState extra_ic_state);
340 341
341 static State DefaultCallState(int argc, CallType call_type) { 342 static State MonomorphicArrayCallState(int argc, CallType call_type) {
342 return State(argc, call_type); 343 return State(argc, call_type, MONOMORPHIC_ARRAY);
343 } 344 }
344 345
345 static State MegamorphicCallState(int argc, CallType call_type) { 346 static State DefaultCallState(int argc, CallType call_type) {
346 return State(argc, call_type); 347 return State(argc, call_type, DEFAULT);
347 } 348 }
348 349
349 InlineCacheState GetICState() const { return ::v8::internal::GENERIC; } 350 // Transition from the current state to another.
351 State ToGenericState() const {
352 return DefaultCallState(arg_count(), call_type());
353 }
354
355 State ToMonomorphicArrayCallState() const {
356 return MonomorphicArrayCallState(arg_count(), call_type());
357 }
358
359 InlineCacheState GetICState() const {
360 return stub_type_ == CallIC::DEFAULT
361 ? ::v8::internal::GENERIC
362 : ::v8::internal::MONOMORPHIC;
363 }
350 364
351 ExtraICState GetExtraICState() const; 365 ExtraICState GetExtraICState() const;
352 366
353 static void GenerateAheadOfTime( 367 static void GenerateAheadOfTime(
354 Isolate*, void (*Generate)(Isolate*, const State&)); 368 Isolate*, void (*Generate)(Isolate*, const State&));
355 369
356 int arg_count() const { return argc_; } 370 int arg_count() const { return argc_; }
357 CallType call_type() const { return call_type_; } 371 CallType call_type() const { return call_type_; }
372 StubType stub_type() const { return stub_type_; }
358 373
359 bool CallAsMethod() const { return call_type_ == METHOD; } 374 bool CallAsMethod() const { return call_type_ == METHOD; }
360 375
361 void Print(StringStream* stream) const; 376 void Print(StringStream* stream) const;
362 377
363 bool operator==(const State& other_state) const { 378 bool operator==(const State& other_state) const {
364 return (argc_ == other_state.argc_ && 379 return (argc_ == other_state.argc_ &&
365 call_type_ == other_state.call_type_); 380 call_type_ == other_state.call_type_);
366 } 381 }
367 382
368 bool operator!=(const State& other_state) const { 383 bool operator!=(const State& other_state) const {
369 return !(*this == other_state); 384 return !(*this == other_state);
370 } 385 }
371 386
372 private: 387 private:
373 State(int argc, 388 State(int argc, CallType call_type, StubType stub_type)
374 CallType call_type)
375 : argc_(argc), 389 : argc_(argc),
376 call_type_(call_type) { 390 call_type_(call_type),
391 stub_type_(stub_type) {
377 } 392 }
378 393
379 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {}; 394 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {};
380 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {}; 395 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {};
396 class StubTypeBits:
397 public BitField<StubType, Code::kArgumentsBits + 1, 1> {}; // NOLINT
381 398
382 const int argc_; 399 const int argc_;
383 const CallType call_type_; 400 const CallType call_type_;
401 const StubType stub_type_;
384 }; 402 };
385 403
386 explicit CallIC(Isolate* isolate) 404 explicit CallIC(Isolate* isolate)
387 : IC(EXTRA_CALL_FRAME, isolate) { 405 : IC(EXTRA_CALL_FRAME, isolate) {
388 } 406 }
389 407
390 void HandleMiss(Handle<Object> receiver, 408 void HandleMiss(Handle<Object> receiver,
391 Handle<Object> function, 409 Handle<Object> function,
392 Handle<FixedArray> vector, 410 Handle<FixedArray> vector,
393 Handle<Smi> slot); 411 Handle<Smi> slot);
394 412
413 // Returns true if a custom handler was installed.
414 bool DoCustomHandler(Handle<Object> receiver,
415 Handle<Object> function,
416 Handle<FixedArray> vector,
417 Handle<Smi> slot,
418 const State& new_state);
419
395 // Code generator routines. 420 // Code generator routines.
396 static Handle<Code> initialize_stub(Isolate* isolate, 421 static Handle<Code> initialize_stub(Isolate* isolate,
397 int argc, 422 int argc,
398 CallType call_type); 423 CallType call_type);
399 424
400 static void Clear(Isolate* isolate, Address address, Code* target, 425 static void Clear(Isolate* isolate, Address address, Code* target,
401 ConstantPoolArray* constant_pool); 426 ConstantPoolArray* constant_pool);
402 }; 427 };
403 428
404 429
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); 1055 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss);
1031 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); 1056 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss);
1032 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); 1057 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite);
1033 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); 1058 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss);
1034 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); 1059 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss);
1035 1060
1036 1061
1037 } } // namespace v8::internal 1062 } } // namespace v8::internal
1038 1063
1039 #endif // V8_IC_H_ 1064 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698