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

Side by Side Diff: src/ic.h

Issue 305493003: Reland "Customized support for feedback on calls to Array." and follow-up fixes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Bugfix and tests 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_ &&
381 stub_type_ == other_state.stub_type_);
366 } 382 }
367 383
368 bool operator!=(const State& other_state) const { 384 bool operator!=(const State& other_state) const {
369 return !(*this == other_state); 385 return !(*this == other_state);
370 } 386 }
371 387
372 private: 388 private:
373 State(int argc, 389 State(int argc, CallType call_type, StubType stub_type)
374 CallType call_type)
375 : argc_(argc), 390 : argc_(argc),
376 call_type_(call_type) { 391 call_type_(call_type),
392 stub_type_(stub_type) {
377 } 393 }
378 394
379 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {}; 395 class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {};
380 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {}; 396 class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {};
397 class StubTypeBits:
398 public BitField<StubType, Code::kArgumentsBits + 1, 1> {}; // NOLINT
381 399
382 const int argc_; 400 const int argc_;
383 const CallType call_type_; 401 const CallType call_type_;
402 const StubType stub_type_;
384 }; 403 };
385 404
386 explicit CallIC(Isolate* isolate) 405 explicit CallIC(Isolate* isolate)
387 : IC(EXTRA_CALL_FRAME, isolate) { 406 : IC(EXTRA_CALL_FRAME, isolate) {
388 } 407 }
389 408
390 void HandleMiss(Handle<Object> receiver, 409 void HandleMiss(Handle<Object> receiver,
391 Handle<Object> function, 410 Handle<Object> function,
392 Handle<FixedArray> vector, 411 Handle<FixedArray> vector,
393 Handle<Smi> slot); 412 Handle<Smi> slot);
394 413
414 // Returns true if a custom handler was installed.
415 bool DoCustomHandler(Handle<Object> receiver,
416 Handle<Object> function,
417 Handle<FixedArray> vector,
418 Handle<Smi> slot,
419 const State& new_state);
420
395 // Code generator routines. 421 // Code generator routines.
396 static Handle<Code> initialize_stub(Isolate* isolate, 422 static Handle<Code> initialize_stub(Isolate* isolate,
397 int argc, 423 int argc,
398 CallType call_type); 424 CallType call_type);
399 425
400 static void Clear(Isolate* isolate, Address address, Code* target, 426 static void Clear(Isolate* isolate, Address address, Code* target,
401 ConstantPoolArray* constant_pool); 427 ConstantPoolArray* constant_pool);
402 }; 428 };
403 429
404 430
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss); 1056 DECLARE_RUNTIME_FUNCTION(ElementsTransitionAndStoreIC_Miss);
1031 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss); 1057 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_Miss);
1032 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite); 1058 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite);
1033 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss); 1059 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss);
1034 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss); 1060 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss);
1035 1061
1036 1062
1037 } } // namespace v8::internal 1063 } } // namespace v8::internal
1038 1064
1039 #endif // V8_IC_H_ 1065 #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