Skip to content

Commit

Permalink
Remove legacy bytecode handling
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

A long time ago we experimented with JSC bytecode. We are not experimenting with JSC bytecode any more. This code can be removed.

Reviewed By: mhorowitz

Differential Revision: D22017374

fbshipit-source-id: 6fe3fb7ad7966f92a5cd103605ac5c0bd1f17a8e
  • Loading branch information
cpojer authored and facebook-github-bot committed Jun 16, 2020
1 parent b69041f commit 56689e9
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 35 deletions.
1 change: 0 additions & 1 deletion React/Base/RCTJavaScriptLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ typedef void (^RCTSourceLoadBlock)(NSError *error, RCTSource *source);
* RCTJavaScriptLoaderErrorDomain and the code RCTJavaScriptLoaderErrorCannotBeLoadedSynchronously.
*/
+ (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL
runtimeBCVersion:(int32_t)runtimeBCVersion
sourceLength:(int64_t *)sourceLength
error:(NSError **)error;

Expand Down
29 changes: 1 addition & 28 deletions React/Base/RCTJavaScriptLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

NSString *const RCTJavaScriptLoaderErrorDomain = @"RCTJavaScriptLoaderErrorDomain";

static const int32_t JSNoBytecodeFileFormatVersion = -1;

const UInt32 RCT_BYTECODE_ALIGNMENT = 4;
UInt32 RCTReadUInt32LE(NSData *script, UInt32 offset)
{
Expand Down Expand Up @@ -92,10 +90,7 @@ + (void)loadBundleAtURL:(NSURL *)scriptURL
{
int64_t sourceLength;
NSError *error;
NSData *data = [self attemptSynchronousLoadOfBundleAtURL:scriptURL
runtimeBCVersion:JSNoBytecodeFileFormatVersion
sourceLength:&sourceLength
error:&error];
NSData *data = [self attemptSynchronousLoadOfBundleAtURL:scriptURL sourceLength:&sourceLength error:&error];
if (data) {
onComplete(nil, RCTSourceCreate(scriptURL, data, sourceLength));
return;
Expand All @@ -112,7 +107,6 @@ + (void)loadBundleAtURL:(NSURL *)scriptURL
}

+ (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL
runtimeBCVersion:(int32_t)runtimeBCVersion
sourceLength:(int64_t *)sourceLength
error:(NSError **)error
{
Expand Down Expand Up @@ -203,27 +197,6 @@ + (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL
return nil;
#endif
}
case facebook::react::ScriptTag::BCBundle:
if (runtimeBCVersion == JSNoBytecodeFileFormatVersion || runtimeBCVersion < 0) {
if (error) {
*error = [NSError
errorWithDomain:RCTJavaScriptLoaderErrorDomain
code:RCTJavaScriptLoaderErrorBCNotSupported
userInfo:@{NSLocalizedDescriptionKey : @"Bytecode bundles are not supported by this runtime."}];
}
return nil;
} else if ((uint32_t)runtimeBCVersion != header.version) {
if (error) {
NSString *errDesc = [NSString
stringWithFormat:@"BC Version Mismatch. Expect: %d, Actual: %u", runtimeBCVersion, header.version];

*error = [NSError errorWithDomain:RCTJavaScriptLoaderErrorDomain
code:RCTJavaScriptLoaderErrorBCVersion
userInfo:@{NSLocalizedDescriptionKey : errDesc}];
}
return nil;
}
break;
}

struct stat statInfo;
Expand Down
5 changes: 0 additions & 5 deletions ReactCommon/cxxreact/JSBundleType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ namespace facebook {
namespace react {

static uint32_t constexpr RAMBundleMagicNumber = 0xFB0BD1E5;
static uint32_t constexpr BCBundleMagicNumber = 0x6D657300;

ScriptTag parseTypeFromHeader(const BundleHeader &header) {
switch (folly::Endian::little(header.magic)) {
case RAMBundleMagicNumber:
return ScriptTag::RAMBundle;
case BCBundleMagicNumber:
return ScriptTag::BCBundle;
default:
return ScriptTag::String;
}
Expand All @@ -32,8 +29,6 @@ const char *stringForScriptTag(const ScriptTag &tag) {
return "String";
case ScriptTag::RAMBundle:
return "RAM Bundle";
case ScriptTag::BCBundle:
return "BC Bundle";
}
return "";
}
Expand Down
1 change: 0 additions & 1 deletion ReactCommon/cxxreact/JSBundleType.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ namespace react {
enum struct ScriptTag {
String = 0,
RAMBundle,
BCBundle,
};

/**
Expand Down

0 comments on commit 56689e9

Please sign in to comment.