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

Side by Side Diff: src/contexts.cc

Issue 1306993003: Call JS functions via native context instead of js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 3 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
« no previous file with comments | « src/contexts.h ('k') | src/date.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #include "src/contexts.h" 5 #include "src/contexts.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/scopeinfo.h" 9 #include "src/scopeinfo.h"
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 Handle<Object> Context::Lookup(Handle<String> name, 238 Handle<Object> Context::Lookup(Handle<String> name,
239 ContextLookupFlags flags, 239 ContextLookupFlags flags,
240 int* index, 240 int* index,
241 PropertyAttributes* attributes, 241 PropertyAttributes* attributes,
242 BindingFlags* binding_flags) { 242 BindingFlags* binding_flags) {
243 Isolate* isolate = GetIsolate(); 243 Isolate* isolate = GetIsolate();
244 Handle<Context> context(this, isolate); 244 Handle<Context> context(this, isolate);
245 245
246 bool follow_context_chain = (flags & FOLLOW_CONTEXT_CHAIN) != 0; 246 bool follow_context_chain = (flags & FOLLOW_CONTEXT_CHAIN) != 0;
247 *index = -1; 247 *index = kNotFound;
248 *attributes = ABSENT; 248 *attributes = ABSENT;
249 *binding_flags = MISSING_BINDING; 249 *binding_flags = MISSING_BINDING;
250 250
251 if (FLAG_trace_contexts) { 251 if (FLAG_trace_contexts) {
252 PrintF("Context::Lookup("); 252 PrintF("Context::Lookup(");
253 name->ShortPrint(); 253 name->ShortPrint();
254 PrintF(")\n"); 254 PrintF(")\n");
255 } 255 }
256 256
257 do { 257 do {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 530
531 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { 531 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() {
532 Isolate* isolate = GetIsolate(); 532 Isolate* isolate = GetIsolate();
533 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate); 533 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate);
534 if (!result->IsUndefined()) return result; 534 if (!result->IsUndefined()) return result;
535 return isolate->factory()->NewStringFromStaticChars( 535 return isolate->factory()->NewStringFromStaticChars(
536 "Code generation from strings disallowed for this context"); 536 "Code generation from strings disallowed for this context");
537 } 537 }
538 538
539 539
540 #define COMPARE_NAME(index, type, name) \
541 if (string->IsOneByteEqualTo(STATIC_CHAR_VECTOR(#name))) return index;
542
543 int Context::ImportedFieldIndexForName(Handle<String> string) {
544 NATIVE_CONTEXT_IMPORTED_FIELDS(COMPARE_NAME)
545 return kNotFound;
546 }
547
548
549 int Context::IntrinsicIndexForName(Handle<String> string) {
550 NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(COMPARE_NAME);
551 return kNotFound;
552 }
553
554 #undef COMPARE_NAME
555
556
540 #ifdef DEBUG 557 #ifdef DEBUG
541 bool Context::IsBootstrappingOrValidParentContext( 558 bool Context::IsBootstrappingOrValidParentContext(
542 Object* object, Context* child) { 559 Object* object, Context* child) {
543 // During bootstrapping we allow all objects to pass as 560 // During bootstrapping we allow all objects to pass as
544 // contexts. This is necessary to fix circular dependencies. 561 // contexts. This is necessary to fix circular dependencies.
545 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; 562 if (child->GetIsolate()->bootstrapper()->IsActive()) return true;
546 if (!object->IsContext()) return false; 563 if (!object->IsContext()) return false;
547 Context* context = Context::cast(object); 564 Context* context = Context::cast(object);
548 return context->IsNativeContext() || context->IsScriptContext() || 565 return context->IsNativeContext() || context->IsScriptContext() ||
549 context->IsModuleContext() || !child->IsModuleContext(); 566 context->IsModuleContext() || !child->IsModuleContext();
550 } 567 }
551 568
552 569
553 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 570 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
554 // During bootstrapping we allow all objects to pass as global 571 // During bootstrapping we allow all objects to pass as global
555 // objects. This is necessary to fix circular dependencies. 572 // objects. This is necessary to fix circular dependencies.
556 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 573 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
557 isolate->bootstrapper()->IsActive() || 574 isolate->bootstrapper()->IsActive() ||
558 object->IsGlobalObject(); 575 object->IsGlobalObject();
559 } 576 }
560 #endif 577 #endif
561 578
562 } // namespace internal 579 } // namespace internal
563 } // namespace v8 580 } // namespace v8
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698